static IEnumerator Fight() //Handles and manages the FightScene { gP = GamePhase.Attack; while (AttackMaster.CombatCount != 0) { float rotation; if (PlayerMaster.CurrentTurn == 0) { rotation = 180; } else { rotation = 0; } instance.StartCoroutine(TopDownCamera.LerpToPosition(AttackMaster.CenterOfCombat(), Quaternion.Euler(90, rotation, 0))); yield return(new WaitForSeconds(2.0f)); //Wait to give the player a chance to see stuff instance.StartCoroutine(UIMaster.MoveCurtains(true)); //lower curtains yield return(null); //Wait at least one frame so that UIMaster.MovingCurtians can change value while (UIMaster.MovingCurtains) { yield return(null); } List <Unit> currentCombat = AttackMaster.CurrentCombatArea; List <Unit> toKill = AttackMaster.FightResults(); FightSceneMaster.SetUpFight(currentCombat, toKill); //Prepare the fightscene yield return(new WaitForSeconds(1.0f)); //Pause for dramatic effect instance.StartCoroutine(UIMaster.MoveCurtains(false)); //Raise Curtains yield return(null); while (UIMaster.MovingCurtains) { yield return(null); } SoundMaster.AttackCharge(); instance.StartCoroutine(FightSceneMaster.ToBattle()); //Begins FightScene yield return(null); //Wait at least one frame so that FightSceneMaster.Fighting can change value while (FightSceneMaster.Fighting) { yield return(null); } //SoundMaster.AttackResolution(); instance.StartCoroutine(UIMaster.MoveCurtains(true)); //Lower curtains again yield return(null); //Wait at least one frame so that UIMaster.MovingCurtians can change value while (UIMaster.MovingCurtains) { yield return(null); } FightSceneMaster.CleanUp(); //Resets FightScene yield return(new WaitForSeconds(0.25f)); //Pause instance.StartCoroutine(UIMaster.MoveCurtains(false)); //Raise curtains yield return(new WaitForFixedUpdate()); //Wait at least one frame so that UIMaster.MovingCurtians can change value while (UIMaster.MovingCurtains) { yield return(null); } yield return(new WaitForSeconds(1.0f)); foreach (Unit u in toKill) { PlayerMaster.KillUnit(u); //Kills dead units } yield return(new WaitForSeconds(1.0f)); //Pause to see aftermath } //return to player's position after the fight instance.StartCoroutine(TopDownCamera.LerpToPosition(PlayerMaster.CurrentPlayer.CameraPosistion, PlayerMaster.CurrentPlayer.CameraRotation)); DeactivateCannonByMove(PlayerMaster.OtherPlayer); if (PlayerMaster.CurrentTurn == 0) { HighlightMaster.HighlightMovable(PlayerMaster.OtherPlayer); } UIMaster.DisplayScore(); // WinByMove(); UIMaster.SetActionPanel(true); //Turns action pannel back on UIMaster.FadePhanel((int)UIPannels.Action); CannonMaster.CheckCannonCapture(); gP = GamePhase.Move; yield return(ChangeTurn()); acceptInput = true; }