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")
|
+ActiveGameNameRedirects=(OldGameName="TP_ThirdPerson",NewGameName="/Script/the_twilight_abyss")
|
||||||
|
|
||||||
[/Script/EngineSettings.GameMapsSettings]
|
[/Script/EngineSettings.GameMapsSettings]
|
||||||
EditorStartupMap=/Game/Levels/CombatTest.CombatTest
|
EditorStartupMap=/Game/Levels/Prototype.Prototype
|
||||||
LocalMapOptions=
|
LocalMapOptions=
|
||||||
TransitionMap=None
|
TransitionMap=None
|
||||||
bUseSplitscreen=True
|
bUseSplitscreen=True
|
||||||
@ -26,7 +26,7 @@ ThreePlayerSplitscreenLayout=FavorTop
|
|||||||
FourPlayerSplitscreenLayout=Grid
|
FourPlayerSplitscreenLayout=Grid
|
||||||
bOffsetPlayerGamepadIds=False
|
bOffsetPlayerGamepadIds=False
|
||||||
GameInstanceClass=/Script/Engine.GameInstance
|
GameInstanceClass=/Script/Engine.GameInstance
|
||||||
GameDefaultMap=/Game/Levels/CombatTest.CombatTest
|
GameDefaultMap=/Game/Levels/Prototype.Prototype
|
||||||
ServerDefaultMap=/Engine/Maps/Entry.Entry
|
ServerDefaultMap=/Engine/Maps/Entry.Entry
|
||||||
GlobalDefaultGameMode=/Game/Merchant/BP_MerchantGameMode.BP_MerchantGameMode_C
|
GlobalDefaultGameMode=/Game/Merchant/BP_MerchantGameMode.BP_MerchantGameMode_C
|
||||||
GlobalDefaultServerGameMode=None
|
GlobalDefaultServerGameMode=None
|
||||||
|
@ -172,8 +172,11 @@ void ATurnBaseCombat::SwitchTurn()
|
|||||||
//TurnIndicatorTextBlock->SetText(FText::FromString(bIsPlayerTurn ? "Enemy Turn" : "Player Turn"));
|
//TurnIndicatorTextBlock->SetText(FText::FromString(bIsPlayerTurn ? "Enemy Turn" : "Player Turn"));
|
||||||
//bIsPlayerTurn = !bIsPlayerTurn;
|
//bIsPlayerTurn = !bIsPlayerTurn;
|
||||||
TurnIndicatorTextBlock->SetText(FText::FromString("Enemy Turn"));
|
TurnIndicatorTextBlock->SetText(FText::FromString("Enemy Turn"));
|
||||||
DamagePlayer(10);
|
ToggleButtons();
|
||||||
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
|
//wait for 2 seconds
|
||||||
|
FTimerHandle UnusedHandle;
|
||||||
|
GetWorldTimerManager().SetTimer(UnusedHandle, this, &ATurnBaseCombat::EnemyTurn, 2.0f, false);
|
||||||
|
|
||||||
//activeActor = bIsPlayerTurn ? enemyActor : playerActor;
|
//activeActor = bIsPlayerTurn ? enemyActor : playerActor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,3 +280,18 @@ void ATurnBaseCombat::UpdateResourceBars() const
|
|||||||
IronResourceBar->SetPercent(IronResource / 10.0f);
|
IronResourceBar->SetPercent(IronResource / 10.0f);
|
||||||
SulfurResourceBar->SetPercent(SulfurResource / 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 ClearBattleLog();
|
||||||
void UpdateBattleLog();
|
void UpdateBattleLog();
|
||||||
void UpdateResourceBars() const;
|
void UpdateResourceBars() const;
|
||||||
|
void ToggleButtons() const;
|
||||||
|
void EnemyTurn();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user