Example #1
0
    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);
        networkView.group = 1;

        this.scoreManager.OnScoreUpdated += (sender, e) => {
            // Check if the score limit was reached.
            // Someone may have won
            if (e.ScoreData.value > this.ScoreLimit)
            {
                this.EndGame();
            }
        };

        this.OnGameStarted += (sender) => {
            // Reset the game time when the game starts
            this.CurrentGameTime = 0f;
        };

        this.OnGameEnded += (sender) => {
            // Switch to the empty scene once the game ends
            this.ChangeLevel("empty_scene");
        };
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);
        networkView.group = 1;

        this.scoreManager.OnScoreUpdated += (sender, e) => {
            // Check if the score limit was reached.
            // Someone may have won
            if(e.ScoreData.value > this.ScoreLimit)
                this.EndGame();
        };

        this.OnGameStarted += (sender) => {
            // Reset the game time when the game starts
            this.CurrentGameTime = 0f;
        };

        this.OnGameEnded += (sender) => {
            // Switch to the empty scene once the game ends
            this.ChangeLevel("empty_scene");
        };
    }