Ejemplo n.º 1
0
    // System wide initialisation only happens here
    void Awake()
    {
        Util.Trace(1, "GameManager game={0} var={1}\ndir={2}", InitialScript, InitialVariant, Application.dataPath);
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            DestroyObject(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        // if only this would trap into VS
        Assert.raiseExceptions = true;
        //Assert.IsTrue(false);

        State       = GameState.Startup;
        _highscores = GetComponent <HighScores>();
        _uimx       = FindObjectOfType <UiManager>();
        _highscores.LoadScore();

        // change setup here for convenient testing
#if UNITY_EDITOR
        _highscores.ClearScore();
        FindObjectOfType <AudioSource>().mute = true; // set directly -- options panel not started yet
        Items.UserGamesFolder = "test games";
        //InitialScript = "TicTacToe";
        //InitialScript = "Kono";
        //InitialVariant = 0;
#endif
    }