public void StartCombat() { // run combat PlayerCombatResult result = SimulateCombat(); // remove dead units! UpdateArmy(PlayerType.PLAYER); UpdateArmy(PlayerType.AI); // handle results UpdatePlayerHealth(result); // check if next round needs to be scheduled bool gameOver = IsGameOver(); if (!gameOver) { // Update values for next round IncreaseSupplyCap(10); IncreaseMaxWorkers(5); // Update AI Unit Priorities based off the combat result! (once updated combat system is implemented - no point otherwise) // Start timer for next round ScheduleNextRound(); // Remind AI to plan for this round } }
public void UpdateOutcome(PlayerCombatResult result) { if (result == PlayerCombatResult.PLAYER1_WIN) { outcomeText.text = "Victory"; } else if (result == PlayerCombatResult.PLAYER2_WIN) { outcomeText.text = "Defeat"; } else { outcomeText.text = "Draw"; } }
// Decrease player who lost their health points. public void UpdatePlayerHealth(PlayerCombatResult result) { if (result == PlayerCombatResult.PLAYER1_WIN) { GetGameController().GetPlayerModel(PlayerType.AI).DecreaseHealthPoints(); } else if (result == PlayerCombatResult.PLAYER2_WIN) { GetGameController().GetPlayerModel(PlayerType.PLAYER).DecreaseHealthPoints(); } else { // draw } }
public PlayerCombatResult RunCombat() { SetUpCombatInstance(); PlayerCombatResult result = SimulatePlayerCombat(); Debug.Log(result); Debug.Log("player1:"); Debug.Log(player1Units.MapStatusString()); Debug.Log("player2:"); Debug.Log(player2Units.MapStatusString()); // update views UpdateCombatResultView(result); combatResultView.ShowWindow(); return(result); }
private void UpdateCombatResultView(PlayerCombatResult result) { combatResultView.UpdateCombatResultView(player1Units, player2Units); combatResultView.UpdateOutcome(result); }