Beispiel #1
0
 void OnGameStateChange(GameManager.Game_State state)
 {
     if (state == GameManager.Game_State.GAME_PLAY)
     {
         this.Init();
     }
 }
Beispiel #2
0
    private void OnGameStateChange(GameManager.Game_State state)
    {
        if (state == GameManager.Game_State.GAME_PLAY)
        {
            pipeGeneration = MonoManager.Instance.StartCoroutine(GeneratePipes());
        }
        else if (state == GameManager.Game_State.GAME_OVER)
        {
            //stop generating pipes
            if (pipeGeneration != null)
            {
                MonoManager.Instance.StopCoroutine(pipeGeneration);
            }
            pipeGeneration = null;

            //stop all existing pipe
            foreach (var pipe in pipes)
            {
                pipe.IsOn = false;
            }
        }
    }