Example #1
0
    void Awake()
    {
        // Redundant Reset
        ConvergenceController.DestoryConvergenceController();
        Time.timeScale = 1.0f;
        FactionController.SetDefaultFactions();

        // Raise warning if more than one LevelController exists.
        if (current != null)
        {
            Debug.LogWarning("Multiple LevelControllers created. Replacing current.");
        }
        current = this;

        // Check Game for level list
        if (!Game.HasLevelList())
        {
            Game.SetLevelList(DefaultList);
        }

        // Check Game for a selected level
        var selectedLevel = Game.CurrentLevel;

        // If Game has one, else use one assigned in editor
        if (selectedLevel != null)
        {
            CurrentLevel = selectedLevel;
        }

        // If there isn't one and CurrentLevel is still null (i.e. nothing assigned in editor) error is raised.
        if (CurrentLevel == null)
        {
            Debug.LogError("Attempting to start game without any level data.");
            return;
        }
    }
Example #2
0
 void OnDestroy()
 {
     ConvergenceController.DestoryConvergenceController();
     current = null;
 }