49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreTypes.h"
|
|
#include "Delegates/Delegate.h"
|
|
#include "GenericTeamAgentInterface.h"
|
|
#include "Misc/AssertionMacros.h"
|
|
#include "UObject/Object.h"
|
|
#include "UObject/ScriptInterface.h"
|
|
#include "UObject/UObjectGlobals.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;
|
|
}
|
|
};
|