Create Request, Release and Reset Token methods in AIAttackTokenManager
This commit is contained in:
parent
ac45acb232
commit
ec057454c3
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue