AzureAbyss/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.cpp

38 lines
914 B
C++
Raw Normal View History

2022-11-09 20:32:31 +00:00
// Fill out your copyright notice in the Description page of Project Settings.
#include "TurnBaseCombat.h"
#include "Kismet/GameplayStatics.h"
2022-11-09 20:32:31 +00:00
void ATurnBaseCombat::BeginPlay()
{
Super::BeginPlay();
TArray<AActor*> AllCharacterActorsInScene;
UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Character"), AllCharacterActorsInScene);
2022-11-09 20:32:31 +00:00
activeActionPoints = defaultActionPoints;
}
void ATurnBaseCombat::useActionPoint()
{
activeActionPoints -= 1;
activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
}
void ATurnBaseCombat::reuseActionPoint()
{
activeActionPoints += 1;
activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
2022-11-09 20:32:31 +00:00
}
void ATurnBaseCombat::revertActionPoints()
{
activeActionPoints = defaultActionPoints;
}
void ATurnBaseCombat::switchTurn()
{
activeActor = (isPlayerTurn) ? enemyActor : playerActor;
}
2022-11-09 20:32:31 +00:00