void PrepareForBattle(Collision collision) { enemyEncounter = collision.gameObject; // Set everyone (except the enemyEncounter) as inactive via PersistentData script. _pd.BeforeSwitch(enemyEncounter); // Add GameObjects to the combatants list, then order it. OrderTurns(); // Create separate lists from "combatants" for enemies and allies. enemies = order.FindAll(combatant => combatant.tag.Equals("Enemy")); allies = order.Except <GameObject>(enemies).ToList <GameObject>(); allies.RemoveAll(combatant => combatant.tag.Equals("Enemy")); // Save position of player. overworldPos = this.transform.position; monPos = enemyEncounter.transform.position; // Move the player and enemy into position. BattlePosition(enemyEncounter); // Move camera, too. overworldCam.enabled = false; overworldCam.GetComponent <CamFollow>().enabled = false; battleCam.enabled = true; // Disable overworld theme. environment.SetActive(false); // Switch scenes on collision. string sceneName = SceneManager.GetActiveScene().name; if (sceneName != "BattleScene") { StartCoroutine(LoadBattleScene(enemyEncounter)); //*** } // Change battle readiness. (Since we're moving to the BattleScene, ... ready = false; //...we don't need to be ready to enter it.) }