Space Plunder
Loading...
Searching...
No Matches
DoOnce.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "DoOnce.generated.h"
7
8USTRUCT(BlueprintType)
9struct FDoOnce
10{
11 GENERATED_BODY()
12
13 UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
14 bool bDoOnce = false;
15
16 FORCEINLINE FDoOnce();
17 explicit FORCEINLINE FDoOnce(bool bStartClosed);
18
19 FORCEINLINE void Reset(){bDoOnce = true;}
20 FORCEINLINE bool Execute()
21 {
22 if(bDoOnce)
23 {
24 bDoOnce = false;
25 return true;
26 }
27 return false;
28 }
29};
30
31FORCEINLINE FDoOnce::FDoOnce() : bDoOnce(false)
32{
33
34}
35
36FORCEINLINE FDoOnce::FDoOnce(const bool bStartClosed) : bDoOnce(!bStartClosed)
37{
38
39}
Definition DoOnce.h:10
FORCEINLINE bool Execute()
Definition DoOnce.h:20
FORCEINLINE FDoOnce()
Definition DoOnce.h:31