File size: 1,702 Bytes
7fd553e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Engine/CancellableAsyncAction.h"
#include "UObject/ScriptInterface.h"
#include "UObject/WeakInterfacePtr.h"
#include "AsyncAction_ObserveTeam.generated.h"
class ILyraTeamAgentInterface;
struct FFrame;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FTeamObservedAsyncDelegate, bool, bTeamSet, int32, TeamId);
/**
* Watches for team changes in the specified object
*/
UCLASS()
class UAsyncAction_ObserveTeam : public UCancellableAsyncAction
{
GENERATED_UCLASS_BODY()
public:
// Watches for team changes on the specified team agent
// - It will will fire once immediately to give the current team assignment
// - For anything that can ever belong to a team (implements ILyraTeamAgentInterface),
// it will also listen for team assignment changes in the future
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly="true", Keywords="Watch"))
static UAsyncAction_ObserveTeam* ObserveTeam(UObject* TeamAgent);
//~UBlueprintAsyncActionBase interface
virtual void Activate() override;
virtual void SetReadyToDestroy() override;
//~End of UBlueprintAsyncActionBase interface
public:
// Called when the team is set or changed
UPROPERTY(BlueprintAssignable)
FTeamObservedAsyncDelegate OnTeamChanged;
private:
// Watches for team changes on the specified team actor
static UAsyncAction_ObserveTeam* InternalObserveTeamChanges(TScriptInterface<ILyraTeamAgentInterface> TeamActor);
private:
UFUNCTION()
void OnWatchedAgentChangedTeam(UObject* TeamAgent, int32 OldTeam, int32 NewTeam);
TWeakInterfacePtr<ILyraTeamAgentInterface> TeamInterfacePtr;
};
|