Create Request, Release and Reset Token methods in AIAttackTokenManager

This commit is contained in:
Louis Hobbs 2023-08-17 22:28:11 +01:00
parent ac45acb232
commit ec057454c3
2 changed files with 38 additions and 0 deletions

View File

@ -3,3 +3,26 @@
#include "NakatomiAIAttackTokenManager.h"
bool UNakatomiAIAttackTokenManager::RequestToken()
{
if (attackTokensUsed == MAX_ATTACK_TOKEN)
{
return false;
}
attackTokensUsed++;
return true;
}
void UNakatomiAIAttackTokenManager::ReleaseToken()
{
if (attackTokensUsed > 0)
{
attackTokensUsed--;
}
}
void UNakatomiAIAttackTokenManager::Reset()
{
attackTokensUsed = 0;
}

View File

@ -14,4 +14,19 @@ class NAKATOMI_API UNakatomiAIAttackTokenManager : public UObject
{
GENERATED_BODY()
private:
// TODO: This should really be set by the current difficulty setting.
static const int MAX_ATTACK_TOKEN = 5;
int attackTokensUsed = 0;
public:
bool RequestToken();
void ReleaseToken();
void Reset();
};