Updated TurnBaseCombat to End Combat onDeath
This commit is contained in:
parent
b20004e599
commit
521ab6c089
@ -23,9 +23,7 @@ void ATurnBaseCombat::StartCombat()
|
||||
if (HUD->IsInViewport()) return;
|
||||
HUD->AddToViewport();
|
||||
|
||||
APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController());
|
||||
|
||||
if (PC)
|
||||
if (APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController()))
|
||||
{
|
||||
PC->bShowMouseCursor = true;
|
||||
PC->bEnableClickEvents = true;
|
||||
@ -94,6 +92,13 @@ void ATurnBaseCombat::ExecuteCast(FString Combo)
|
||||
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT("Player Damaged %d"), *ValidCombos.Find(Combo)));
|
||||
break;
|
||||
}
|
||||
//End Combat if either the player or enemy is dead
|
||||
if (PlayerHealth <= 0 || EnemyHealth <= 0)
|
||||
{
|
||||
EndCombat();
|
||||
return;
|
||||
}
|
||||
|
||||
SwitchTurn();
|
||||
}
|
||||
|
||||
@ -214,10 +219,8 @@ void ATurnBaseCombat::ClearBattleLog()
|
||||
|
||||
void ATurnBaseCombat::UpdateBattleLog()
|
||||
{
|
||||
TArray<FString> tempArray;
|
||||
//Get the amount of lines in the battle log
|
||||
int32 LineCount = BattleLog.ParseIntoArray(tempArray, TEXT("\n"), true);
|
||||
if (LineCount > 10) //If there are more than 10 lines
|
||||
TArray<FString> TempArray;
|
||||
if (const int32 LineCount = BattleLog.ParseIntoArray(TempArray, TEXT("\n"), true); LineCount > 10)
|
||||
{
|
||||
ClearBattleLog();
|
||||
}
|
||||
|
@ -29,14 +29,13 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
int ActiveActionPoints = 0;
|
||||
|
||||
AActor* PlayerActor;
|
||||
AActor* EnemyActor;
|
||||
AActor* ActiveActor;
|
||||
// AActor* PlayerActor;
|
||||
// AActor* EnemyActor;
|
||||
// AActor* ActiveActor;
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Reference Player Inventory
|
||||
Reference Combat Logging System
|
||||
*/
|
||||
UPROPERTY(EditAnywhere)
|
||||
TSubclassOf<UUserWidget> HUDWidget;
|
||||
|
Loading…
Reference in New Issue
Block a user