Update AI to Be Hostile If Player is Holding a Weapon

This commit is contained in:
Philip W 2024-04-10 15:36:17 +01:00
parent dee776761e
commit 0901cc7973
2 changed files with 7 additions and 1 deletions

View File

@ -102,6 +102,10 @@ void AAI_EnemyController::OnTargetPerceptionUpdated(AActor* Actor, FAIStimulus c
GetBlackboardComponent()->SetValueAsObject("TargetPlayer", Actor); GetBlackboardComponent()->SetValueAsObject("TargetPlayer", Actor);
GetBlackboardComponent()->SetValueAsVector("TargetLocation", Stimulus.StimulusLocation); GetBlackboardComponent()->SetValueAsVector("TargetLocation", Stimulus.StimulusLocation);
GetBlackboardComponent()->SetValueAsBool("CanSeePlayer", true); GetBlackboardComponent()->SetValueAsBool("CanSeePlayer", true);
if (PlayerCharacter->CurrentOverlayState != EOverlayState::Default)
{
GetBlackboardComponent()->SetValueAsBool("IsHostile", true);
}
} }
else if (!Stimulus.WasSuccessfullySensed() && Stimulus.Type == SightConfig->GetSenseID()) else if (!Stimulus.WasSuccessfullySensed() && Stimulus.Type == SightConfig->GetSenseID())
{ {

View File

@ -105,6 +105,8 @@ private:
public: public:
AEndlessVendettaCharacter(); AEndlessVendettaCharacter();
UPROPERTY(BlueprintReadOnly)
EOverlayState CurrentOverlayState = EOverlayState::Default;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Stats") UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Stats")
float CurrentHealth = 100.0f; float CurrentHealth = 100.0f;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats") UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
@ -168,7 +170,7 @@ public:
FSetOverlayState SetOverlayStateEvent; FSetOverlayState SetOverlayStateEvent;
UFUNCTION(BlueprintCallable, Category = "Weapon") UFUNCTION(BlueprintCallable, Category = "Weapon")
void SetOverlayState(EOverlayState OverlayState) const; void SetOverlayState(EOverlayState OverlayState);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FRestrictedAreaStatusChangedSignature, bool, bIsInRestrictedAreaLmao); DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FRestrictedAreaStatusChangedSignature, bool, bIsInRestrictedAreaLmao);