Updated Combat to Centre Cursor

This commit is contained in:
Philip W 2023-04-24 23:25:10 +01:00
parent 18ceedfa03
commit 34e5c78bf1

View File

@ -36,6 +36,8 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
{
if (Enemy == nullptr) return;
const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY());
GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2);
bIsInCombat = true;
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent();
if (!HasSeenTutorial)
@ -100,6 +102,8 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
void ATurnBaseCombatV2::EndCombat()
{
const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY());
GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2);
bEnemyHasExtraTurn = false;
bPlayerHasExtraTurn = false;
bIsInCombat = false;
@ -126,6 +130,8 @@ void ATurnBaseCombatV2::EndCombat()
void ATurnBaseCombatV2::BeginPlay()
{
Super::BeginPlay();
const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY());
GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2);
TArray<AActor*> AllCharacterActorsInScene;
@ -303,7 +309,6 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, FString DamageType)
void ATurnBaseCombatV2::UpdateProgressBars() const
{
//PlayerHealthBar->SetPercent(*PlayerHealth / 100.0f);
EnemyHealthBar->SetPercent(*EnemyHealth / 100.0f);
}
@ -519,4 +524,3 @@ void ATurnBaseCombatV2::EnemyTurn()
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
ToggleButtons();
}