62 lines
1.7 KiB
C
62 lines
1.7 KiB
C
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include "CoreMinimal.h"
|
||
|
#include "ModularPawn.h"
|
||
|
#include "Teams/LyraTeamAgentInterface.h"
|
||
|
|
||
|
#include "LyraPawn.generated.h"
|
||
|
|
||
|
/**
|
||
|
* ALyraPawn
|
||
|
*/
|
||
|
UCLASS()
|
||
|
class ALyraPawn : public AModularPawn, public ILyraTeamAgentInterface
|
||
|
{
|
||
|
GENERATED_BODY()
|
||
|
|
||
|
public:
|
||
|
|
||
|
ALyraPawn(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
||
|
|
||
|
//~AActor interface
|
||
|
virtual void PreInitializeComponents() override;
|
||
|
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||
|
//~End of AActor interface
|
||
|
|
||
|
//~APawn interface
|
||
|
virtual void PossessedBy(AController* NewController) override;
|
||
|
virtual void UnPossessed() override;
|
||
|
//~End of APawn interface
|
||
|
|
||
|
//~ILyraTeamAgentInterface interface
|
||
|
virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override;
|
||
|
virtual FGenericTeamId GetGenericTeamId() const override;
|
||
|
virtual FOnLyraTeamIndexChangedDelegate* GetOnTeamIndexChangedDelegate() override;
|
||
|
//~End of ILyraTeamAgentInterface interface
|
||
|
|
||
|
protected:
|
||
|
// Called to determine what happens to the team ID when possession ends
|
||
|
virtual FGenericTeamId DetermineNewTeamAfterPossessionEnds(FGenericTeamId OldTeamID) const
|
||
|
{
|
||
|
// This could be changed to return, e.g., OldTeamID if you want to keep it assigned afterwards, or return an ID for some neutral faction, or etc...
|
||
|
return FGenericTeamId::NoTeam;
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
UFUNCTION()
|
||
|
void OnControllerChangedTeam(UObject* TeamAgent, int32 OldTeam, int32 NewTeam);
|
||
|
|
||
|
private:
|
||
|
UPROPERTY(ReplicatedUsing = OnRep_MyTeamID)
|
||
|
FGenericTeamId MyTeamID;
|
||
|
|
||
|
UPROPERTY()
|
||
|
FOnLyraTeamIndexChangedDelegate OnTeamChangedDelegate;
|
||
|
|
||
|
private:
|
||
|
UFUNCTION()
|
||
|
void OnRep_MyTeamID(FGenericTeamId OldTeamID);
|
||
|
};
|