private void EndOfTurn() { //Check if either side is dead if (CheckHeroDeaths()) { ActionFunctions.DisplayText("All heroes are dead"); EndBattle(false); return; } if (CheckEnemyDeaths()) { ActionFunctions.DisplayText("All enemies are dead"); EndBattle(true); return; } turnNumber++; //If so start new turn currState = BattleState.STARTOFTURN; return; }
public void EndBattle(bool didHeroesWin) { ActionFunctions.DisplayText("Victory: " + didHeroesWin); //Sets current state of battle currState = BattleState.OUTOFBATTLE; //Reset states of BattleManager //Reward xp and update the heroes if (didHeroesWin) { int totalXP = 0; foreach (EnemyState enemyState in enemyStates) { totalXP += enemyState.enemy.xp; } foreach (HeroState heroState in heroStates) { heroState.hero.xp += totalXP; } List <BaseHero> updatedHeroes = new List <BaseHero>(); foreach (HeroState state in heroStates) { updatedHeroes.Add(state.hero); } HeroManager.GetInstance().ImportHeroList(updatedHeroes); } //Empty the enemylist enemyList.Clear(); //Return to platform level //Remove Enemies from level Debug.Log("Returning to: " + returnSceneID); SceneController.GetInstance().StartCoroutine("SwitchScene", returnSceneID); return; }