2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "GameFramework/Actor.h"
|
|
|
|
#include "GenericTeamAgentInterface.h"
|
|
|
|
#include "HAL/Platform.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "ModularAIController.h"
|
|
|
|
#include "Teams/LyraTeamAgentInterface.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "UObject/UObjectGlobals.h"
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "LyraPlayerBotController.generated.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
class APlayerState;
|
|
|
|
class UAIPerceptionComponent;
|
|
|
|
class UObject;
|
|
|
|
struct FFrame;
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
/**
|
|
|
|
* 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()
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<APlayerState> LastSeenPlayerState;
|
2022-05-23 18:41:30 +00:00
|
|
|
};
|