Updated TurnBaseCombat for Switching Active Roles

Added Switching Active Roles and Constrained Active Action Points
This commit is contained in:
Philip W 2022-11-09 21:03:47 +00:00
parent b678c25377
commit 5907d5dbe8
2 changed files with 17 additions and 1 deletions

View File

@ -14,6 +14,13 @@ void ATurnBaseCombat::BeginPlay()
void ATurnBaseCombat::useActionPoint()
{
activeActionPoints -= 1;
activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
}
void ATurnBaseCombat::reuseActionPoint()
{
activeActionPoints += 1;
activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
}
void ATurnBaseCombat::revertActionPoints()
@ -21,4 +28,9 @@ void ATurnBaseCombat::revertActionPoints()
activeActionPoints = defaultActionPoints;
}
void ATurnBaseCombat::switchTurn()
{
activeActor = (isPlayerTurn) ? enemyActor : playerActor;
}

View File

@ -27,20 +27,24 @@ public:
AActor* playerActor;
AActor* enemyActor;
AActor* activeActor;
/*
TODO:
Reference Blueprint HUD
Reference Action Library
Reference Player Inventory
Reference Player Inventory
Reference Combat Logging System
*/
protected:
virtual void BeginPlay() override;
void useActionPoint();
void reuseActionPoint();
void revertActionPoints();
private:
UPROPERTY(EditDefaultsOnly)
bool isPlayerTurn = true;
void switchTurn();
};