Пример #1
0
    void HandleInput()
    {
        if (!paused)
        {
            if (Input.GetMouseButtonDown(0))
            {
                if (numPlayers != 2)
                {
                    Jump();
                }
            }
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Application.LoadLevel("menu");
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                Jump();
            }
            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
                touch1Bool = true;
            }

            if (Input.GetTouch(1).phase == TouchPhase.Began)
            {
                touch2Bool = true;
            }
            if (touch1Bool && touch2Bool)
            {
                Jump();
                objPlayer2.Jump();
            }
            if (Input.GetTouch(0).phase == TouchPhase.Ended || Input.GetTouch(0).phase == TouchPhase.Stationary || Input.GetTouch(0).phase == TouchPhase.Moved)
            {
                touch1Bool = false;
            }
            if (Input.GetTouch(1).phase == TouchPhase.Ended || Input.GetTouch(1).phase == TouchPhase.Stationary || Input.GetTouch(1).phase == TouchPhase.Moved)
            {
                touch2Bool = false;
            }
        }
    }