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