#pragma once #include "CoreMinimal.h" #include "Components/ActorComponent.h" #include "DamageData.h" #include "DelegateDelegate.h" #include "PawnAlertComponent.generated.h" class APawn; UCLASS(Blueprintable, ClassGroup=Custom, meta=(BlueprintSpawnableComponent)) class UPawnAlertComponent : public UActorComponent { GENERATED_BODY() public: UPROPERTY(BlueprintAssignable, BlueprintAuthorityOnly, BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) FDelegate OnAlertedFromDamage; UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) bool AutoAlertAI; UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) bool ShouldAlertNearby; UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) float AlertRadius; UPawnAlertComponent(); UFUNCTION(BlueprintCallable) void StopAutoAlerting(); protected: UFUNCTION(BlueprintCallable) void OnPawnSeen(APawn* Pawn); UFUNCTION(BlueprintCallable) void OnHit(float Damage, const FDamageData& DamageData, bool anyHealthLost); UFUNCTION(BlueprintCallable) void OnAlerted(); public: UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) void AleartNearby(); };