You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "UObject/ScriptInterface.h"
|
|
#include "GameplayTaskOwnerInterface.h"
|
|
#include "GameplayTask.h"
|
|
#include "GameplayTask_TimeLimitedExecution.generated.h"
|
|
|
|
/**
|
|
* Adds time limit for running a child task
|
|
* - child task needs to be created with UGameplayTask_TimeLimitedExecution passed as TaskOwner
|
|
* - activations are tied together and when either UGameplayTask_TimeLimitedExecution or child task is activated, other one starts as well
|
|
* - OnFinished and OnTimeExpired are mutually exclusive
|
|
*/
|
|
UCLASS(MinimalAPI)
|
|
class UGameplayTask_TimeLimitedExecution : public UGameplayTask
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FTaskFinishDelegate);
|
|
|
|
public:
|
|
UGameplayTask_TimeLimitedExecution(const FObjectInitializer& ObjectInitializer);
|
|
|
|
/** called when child task finishes execution before time runs out */
|
|
UPROPERTY(BlueprintAssignable)
|
|
FTaskFinishDelegate OnFinished;
|
|
|
|
/** called when time runs out */
|
|
UPROPERTY(BlueprintAssignable)
|
|
FTaskFinishDelegate OnTimeExpired;
|
|
|
|
virtual void Activate() override;
|
|
virtual void OnGameplayTaskActivated(UGameplayTask& Task) override;
|
|
virtual void OnGameplayTaskDeactivated(UGameplayTask& Task) override;
|
|
|
|
/** Return debug string describing task */
|
|
virtual FString GetDebugString() const override;
|
|
|
|
GAMEPLAYTASKS_API static UGameplayTask_TimeLimitedExecution* LimitExecutionTime(IGameplayTaskOwnerInterface& InTaskOwner, float Time, const uint8 Priority = FGameplayTasks::DefaultPriority, const FName InInstanceName = FName());
|
|
|
|
private:
|
|
|
|
void OnTimer();
|
|
|
|
float Time;
|
|
float TimeStarted;
|
|
|
|
uint32 bTimeExpired : 1;
|
|
uint32 bChildTaskFinished : 1;
|
|
};
|