Add method to create and get AIAttackTokenManger

This commit is contained in:
Louis Hobbs 2023-08-17 21:47:53 +01:00
parent 57abe9a3a2
commit ac45acb232
2 changed files with 15 additions and 0 deletions

View File

@ -3,3 +3,7 @@
#include "NakatomiGameInstance.h" #include "NakatomiGameInstance.h"
UNakatomiAIAttackTokenManager* UNakatomiGameInstance::GetAIAttackTokenManager()
{
return IsValid(AIAttackTokenManager) ? AIAttackTokenManager : (AIAttackTokenManager = NewObject<UNakatomiAIAttackTokenManager>(this, TEXT("AI Attack Token Manager")));
}

View File

@ -4,6 +4,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Engine/GameInstance.h" #include "Engine/GameInstance.h"
#include "NakatomiAIAttackTokenManager.h"
#include "NakatomiGameInstance.generated.h" #include "NakatomiGameInstance.generated.h"
/** /**
@ -13,5 +14,15 @@ UCLASS()
class NAKATOMI_API UNakatomiGameInstance : public UGameInstance class NAKATOMI_API UNakatomiGameInstance : public UGameInstance
{ {
GENERATED_BODY() GENERATED_BODY()
private:
UPROPERTY()
UNakatomiAIAttackTokenManager* AIAttackTokenManager;
public:
UFUNCTION(BlueprintCallable)
UNakatomiAIAttackTokenManager* GetAIAttackTokenManager();
}; };