示例#1
0
    /// <summary>
    /// Resets the Regions, Units, Camera and Spotlights.
    /// </summary>
    void ResetGame()
    {
        for (int i = 0; i < _regions.Count; i++)
        {//destroy all regions
            Destroy(_regions[(RegionOrder)i].gameObject);
        }
        _regions.Clear();

        ///generate new ones and restart the game.
        GenerateRegions();

        for (int i = 0; i < _units.Count; i++)
        {//reset each unit.
            _units[i].Reset();
        }

        //reset teh camera
        _camera.ResetToTarget(_units[0].transform);

        for (int i = 0; i < _spotLights.Length; i++)
        {//reset each spotlight.
            _spotLights[i].ResetToTarget(_units[0].transform);
            _spotLights[i].SetCurrentColour(_units[0].colour);
        }
    }