46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include "CoreMinimal.h"
|
||
|
#include "UObject/ObjectMacros.h"
|
||
|
#include "GenericTeamAgentInterface.h"
|
||
|
#include "UObject/ScriptInterface.h"
|
||
|
|
||
|
#include "LyraTeamAgentInterface.generated.h"
|
||
|
|
||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnLyraTeamIndexChangedDelegate, UObject*, ObjectChangingTeam, int32, OldTeamID, int32, NewTeamID);
|
||
|
|
||
|
inline int32 GenericTeamIdToInteger(FGenericTeamId ID)
|
||
|
{
|
||
|
return (ID == FGenericTeamId::NoTeam) ? INDEX_NONE : (int32)ID;
|
||
|
}
|
||
|
|
||
|
inline FGenericTeamId IntegerToGenericTeamId(int32 ID)
|
||
|
{
|
||
|
return (ID == INDEX_NONE) ? FGenericTeamId::NoTeam : FGenericTeamId((uint8)ID);
|
||
|
}
|
||
|
|
||
|
/** Interface for actors which can be associated with teams */
|
||
|
UINTERFACE(meta=(CannotImplementInterfaceInBlueprint))
|
||
|
class ULyraTeamAgentInterface : public UGenericTeamAgentInterface
|
||
|
{
|
||
|
GENERATED_UINTERFACE_BODY()
|
||
|
};
|
||
|
|
||
|
class LYRAGAME_API ILyraTeamAgentInterface : public IGenericTeamAgentInterface
|
||
|
{
|
||
|
GENERATED_IINTERFACE_BODY()
|
||
|
|
||
|
virtual FOnLyraTeamIndexChangedDelegate* GetOnTeamIndexChangedDelegate() { return nullptr; }
|
||
|
|
||
|
static void ConditionalBroadcastTeamChanged(TScriptInterface<ILyraTeamAgentInterface> This, FGenericTeamId OldTeamID, FGenericTeamId NewTeamID);
|
||
|
|
||
|
FOnLyraTeamIndexChangedDelegate& GetTeamChangedDelegateChecked()
|
||
|
{
|
||
|
FOnLyraTeamIndexChangedDelegate* Result = GetOnTeamIndexChangedDelegate();
|
||
|
check(Result);
|
||
|
return *Result;
|
||
|
}
|
||
|
};
|