// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "GameFramework/Actor.h" #include "GenericTeamAgentInterface.h" #include "HAL/Platform.h" #include "ModularAIController.h" #include "Teams/LyraTeamAgentInterface.h" #include "UObject/UObjectGlobals.h" #include "LyraPlayerBotController.generated.h" class APlayerState; class UAIPerceptionComponent; class UObject; struct FFrame; /** * ALyraPlayerBotController * * The controller class used by player bots in this project. */ UCLASS(Blueprintable) class ALyraPlayerBotController : public AModularAIController, public ILyraTeamAgentInterface { GENERATED_BODY() public: ALyraPlayerBotController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); //~ILyraTeamAgentInterface interface virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override; virtual FGenericTeamId GetGenericTeamId() const override; virtual FOnLyraTeamIndexChangedDelegate* GetOnTeamIndexChangedDelegate() override; ETeamAttitude::Type GetTeamAttitudeTowards(const AActor& Other) const override; //~End of ILyraTeamAgentInterface interface // Attempts to restart this controller (e.g., to respawn it) void ServerRestartController(); //Update Team Attitude for the AI UFUNCTION(BlueprintCallable, Category = "Lyra AI Player Controller") void UpdateTeamAttitude(UAIPerceptionComponent* AIPerception); virtual void OnUnPossess() override; private: UFUNCTION() void OnPlayerStateChangedTeam(UObject* TeamAgent, int32 OldTeam, int32 NewTeam); protected: // Called when the player state is set or cleared virtual void OnPlayerStateChanged(); private: void BroadcastOnPlayerStateChanged(); protected: //~AController interface virtual void InitPlayerState() override; virtual void CleanupPlayerState() override; virtual void OnRep_PlayerState() override; //~End of AController interface private: UPROPERTY() FOnLyraTeamIndexChangedDelegate OnTeamChangedDelegate; UPROPERTY() TObjectPtr LastSeenPlayerState; };