Updated TurnBaseCombat for Simple Combat AI
This commit is contained in:
parent
96273d16d9
commit
c852de30ec
@ -17,7 +17,7 @@ ManualIPAddress=
|
||||
+ActiveGameNameRedirects=(OldGameName="TP_ThirdPerson",NewGameName="/Script/the_twilight_abyss")
|
||||
|
||||
[/Script/EngineSettings.GameMapsSettings]
|
||||
EditorStartupMap=/Game/Levels/CombatTest.CombatTest
|
||||
EditorStartupMap=/Game/Levels/Prototype.Prototype
|
||||
LocalMapOptions=
|
||||
TransitionMap=None
|
||||
bUseSplitscreen=True
|
||||
@ -26,7 +26,7 @@ ThreePlayerSplitscreenLayout=FavorTop
|
||||
FourPlayerSplitscreenLayout=Grid
|
||||
bOffsetPlayerGamepadIds=False
|
||||
GameInstanceClass=/Script/Engine.GameInstance
|
||||
GameDefaultMap=/Game/Levels/CombatTest.CombatTest
|
||||
GameDefaultMap=/Game/Levels/Prototype.Prototype
|
||||
ServerDefaultMap=/Engine/Maps/Entry.Entry
|
||||
GlobalDefaultGameMode=/Game/Merchant/BP_MerchantGameMode.BP_MerchantGameMode_C
|
||||
GlobalDefaultServerGameMode=None
|
||||
|
@ -172,8 +172,11 @@ void ATurnBaseCombat::SwitchTurn()
|
||||
//TurnIndicatorTextBlock->SetText(FText::FromString(bIsPlayerTurn ? "Enemy Turn" : "Player Turn"));
|
||||
//bIsPlayerTurn = !bIsPlayerTurn;
|
||||
TurnIndicatorTextBlock->SetText(FText::FromString("Enemy Turn"));
|
||||
DamagePlayer(10);
|
||||
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
|
||||
ToggleButtons();
|
||||
//wait for 2 seconds
|
||||
FTimerHandle UnusedHandle;
|
||||
GetWorldTimerManager().SetTimer(UnusedHandle, this, &ATurnBaseCombat::EnemyTurn, 2.0f, false);
|
||||
|
||||
//activeActor = bIsPlayerTurn ? enemyActor : playerActor;
|
||||
}
|
||||
|
||||
@ -277,3 +280,18 @@ void ATurnBaseCombat::UpdateResourceBars() const
|
||||
IronResourceBar->SetPercent(IronResource / 10.0f);
|
||||
SulfurResourceBar->SetPercent(SulfurResource / 10.0f);
|
||||
}
|
||||
|
||||
void ATurnBaseCombat::ToggleButtons() const
|
||||
{
|
||||
FButton->SetIsEnabled(!FButton->bIsEnabled);
|
||||
WButton->SetIsEnabled(!WButton->bIsEnabled);
|
||||
BackspaceButton->SetIsEnabled(!BackspaceButton->bIsEnabled);
|
||||
CastButton->SetIsEnabled(!CastButton->bIsEnabled);
|
||||
}
|
||||
|
||||
void ATurnBaseCombat::EnemyTurn()
|
||||
{
|
||||
DamagePlayer(10);
|
||||
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
|
||||
ToggleButtons();
|
||||
}
|
||||
|
@ -138,4 +138,6 @@ private:
|
||||
void ClearBattleLog();
|
||||
void UpdateBattleLog();
|
||||
void UpdateResourceBars() const;
|
||||
void ToggleButtons() const;
|
||||
void EnemyTurn();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user