IEnumerator WorkHorse() //per frame { float tempTime = 0; while (true) { //Debug.Log("CurrentState: " + currentState); switch (currentState) { case (BattleStates.START): //setup battle function //sends to wait break; case (BattleStates.WIN): tempTime = 4; winLoseScript.WinLose(true); break; case (BattleStates.LOSE): tempTime = 1; winLoseScript.WinLose(false); break; case (BattleStates.WAIT): tempTime = .02f; //update who goes next battleStateWaitScript.UpdateTurnLocation(); //sends to the correct enemy, player, or npc break; case (BattleStates.playerChoice): //this is done in BattleGUI tempTime = .1f; break; case (BattleStates.playerAnimate): tempTime = 3; break; case (BattleStates.npcChoice): npcChoiceScript.NpcChoice(npc); tempTime = 2; break; case (BattleStates.enemyChoice): //number should be 0 through 3 enemyChoiceScript.EnemyChoice(monster); tempTime = 2; break; case (BattleStates.calcDamage): battleCalcScript.CalculateTotalDamage(usedSkill); //sends to wait tempTime = .1f; break; case (BattleStates.addStatusEffects): addStatusEffectsScript.CheckSkillForStatusEffects(usedSkill); //sends to calculate damage tempTime = 2; break; } yield return(new WaitForSeconds(tempTime)); } }