Пример #1
0
    public void onClick()
    {
        //UI
        Animation anim = panel.GetComponent <Animation>();

        anim["Anim_pause"].speed = -2;
        anim.Play("Anim_pause");
        //设置倒放
        anim_unscaledTime ctrl = panel.GetComponent <anim_unscaledTime>();

        ctrl.progress  = 0.85f;
        ctrl.isReverse = true;
        Debug.Log("Game Resumed");
    }
Пример #2
0
 //检查暂停状态
 private void checkPause()
 {
     if (Input.GetButtonDown("Pause") && !isGameOver)
     {
         if (!gameController.isLoadingPanelSpawned)
         {
             if ((!isLevelPaused || !isLevelStarted) && panel_pause_inscene == null)
             {
                 //更改状态和时间缩放
                 isLevelPaused  = true;
                 Time.timeScale = 0;
                 //ui
                 panel_pause_inscene = Instantiate(panel_pause, canvas.transform);
                 //设置关卡名Text
                 GameObject txt_levelname = panel_pause_inscene.transform.Find("txt_levelname").gameObject;
                 Text       txt           = txt_levelname.GetComponent <Text>();
                 txt.text = level_name;
                 //设置coin
                 GameObject txt_coin = panel_pause_inscene.transform.Find("txt_coin").gameObject;
                 txt      = txt_coin.GetComponent <Text>();
                 txt.text = playerController.coin.ToString();
                 //anim
                 Animation anim = panel_pause_inscene.GetComponent <Animation>();
                 anim.Play("Anim_pause");
                 //stat
                 statController.pauseCount++;
                 statController.saveData();
                 Debug.Log("Game Paused");
             }
             else
             {
                 //UI
                 Animation anim = panel_pause_inscene.GetComponent <Animation>();
                 anim["Anim_pause"].speed = -2;
                 anim.Play("Anim_pause");
                 //设置倒放
                 anim_unscaledTime ctrl = panel_pause_inscene.GetComponent <anim_unscaledTime>();
                 ctrl.progress  = 0.85f;
                 ctrl.isReverse = true;
                 Debug.Log("Game Resumed");
             }
         }
     }
 }