// get the next contestant to move public void NextTurn() { if (turnQueue.Count == 0 && nextQueue.Count == 0) { Debug.Log("Error: No units in battle!"); return; } else if (turnQueue.Count == 0) { // start next round turnQueue = nextQueue; turnQueue.Sort(); nextQueue = new List <UnitStats>(); } GameObject[] playerUnits = GameObject.FindGameObjectsWithTag("PlayerUnit"); GameObject[] enemyUnits = GameObject.FindGameObjectsWithTag("EnemyUnit"); if (playerUnits.Length == 0) { Lose(); return; } if (enemyUnits.Length == 0) { Win(); return; } contestant = turnQueue[0]; if (contestant.tag == "EnemyUnit") { TurnOffMenus(); } else if (contestant.tag == "PlayerUnit") { StartPlayerTurn(contestant); } turnQueue.Remove(contestant); nextQueue.Add(contestant); contestant.Act(this); }