/// <summary> /// Updates all of the units /// </summary> void UpdateUnits() { int topUnit = 0; int index = 0; bool allDead = true; for (int i = 0; i < _units.Count; i++) {//update each unit UpdateUnit(_units[i], ref topUnit, ref index, ref allDead, i); } //try to set the new top unit to be tracked. TrackTopUnit(index, topUnit); //set the target of the camera to the current target. _camera.SetTarget(_units[_currentTarget].transform); for (int i = 0; i < _spotLights.Length; i++) {//set each spotlight to point at its target. _spotLights[i].SetTarget(_units[_currentTarget].transform); _spotLights[i].SetTargetColour(_units[_currentTarget].colour); } if (allDead) {//if all units are dead, set game over. SetupGameOver(); } }