2022-11-09 20:32:31 +00:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
|
|
#include "TurnBaseCombat.h"
|
2022-11-09 21:24:36 +00:00
|
|
|
#include "Kismet/GameplayStatics.h"
|
2022-11-09 20:32:31 +00:00
|
|
|
|
|
|
|
void ATurnBaseCombat::BeginPlay()
|
|
|
|
{
|
|
|
|
Super::BeginPlay();
|
2022-11-09 21:24:36 +00:00
|
|
|
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;
|
2022-11-09 21:03:47 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2022-11-09 21:03:47 +00:00
|
|
|
void ATurnBaseCombat::switchTurn()
|
|
|
|
{
|
|
|
|
activeActor = (isPlayerTurn) ? enemyActor : playerActor;
|
|
|
|
}
|
|
|
|
|
2022-11-09 20:32:31 +00:00
|
|
|
|