Example #1
0
    // Deal with GUI components
    bool checkTouch(Vector3 pos)
    {
        Vector3    wp       = Camera.main.ScreenToWorldPoint(pos);
        Vector2    touchPos = new Vector2(wp.x, wp.y);
        Collider2D hit      = Physics2D.OverlapPoint(touchPos);

        if (hit != null && hit.transform.gameObject.tag == "GUI")
        {
            // Pause
            if (hit.transform.gameObject == pauseButton)
            {
                pauseScript.TogglePause();
            }
            // Resume from pause menu
            else if (hit.transform.gameObject == resumeButton)
            {
                pauseScript.Unpause();
            }
            else if (hit.transform.gameObject == restartButton)
            {
                // Unpause game
                pauseScript.Unpause();

                // Reload level
                SceneManager.LoadScene("Bruno");
            }
            else if (hit.transform.gameObject == mainMenuButton)
            {
                SceneManager.LoadScene("MainMenu");
            }
            return(true);
        }

        return(false);
    }
Example #2
0
    void Update()
    {
        if (InputManager.ActiveDevice.MenuWasPressed && pauseMenu.activeInHierarchy)
        {
            if (pauseScript.Unpause())
            {
                pauseMenu.SetActive(false);
            }
        }
        else if (InputManager.ActiveDevice.MenuWasPressed)
        {
            pauseMenu.SetActive(true);
            pauseScript.Pause();
        }


        switch (state)
        {
        case update_status.REGULAR_UPDATE:

            lag = Time.deltaTime;
            break;

        case update_status.UPDATE_REQUESTED:

            doUpdate = true;
            state    = update_status.UPDATING;
            break;

        case update_status.UPDATING:
            doUpdate = false;
            state    = update_status.WAITING;
            break;
        }
    }
Example #3
0
 public void Reset(int level)
 {
     pauseScript.Unpause();
     Application.LoadLevel(level);
 }