示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Cancel") || Input.GetButtonDown("Submit"))
        {
            if (!_paused)
            {
                Time.timeScale = 0;
                if (speedrunTimer != null)
                {
                    if (speedrunTimer.activeSelf)
                    {
                        Speedrun.StopTimer();
                        Debug.Log("Stop");
                    }
                }

                _paused = true;
            }
            else if (_paused)
            {
                Time.timeScale = 1;
                if (speedrunTimer != null)
                {
                    if (speedrunTimer.activeSelf)
                    {
                        Speedrun.RestartTimer();
                        Debug.Log("Restart");
                    }
                }

                _paused = false;
            }
        }
    }
示例#2
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            _instance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }