Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (PhotonNetwork.IsConnected && !photonView.IsMine)
        {
            return;
        }

        #region Keyboard inputs
        //keyboard input
        horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;

        if (Input.GetButtonDown("Jump"))
        {
            jump = true;
        }
        #endregion

        #region On-screen inputs
        //Onscreen input
        if (controllerListener != null)
        {
            if (Input.GetAxisRaw("Horizontal") == 0)
            {
                horizontalMove = controllerListener.GetHorizontalRaw() * runSpeed;
            }

            /*
             * Moved to FixedUpdate
             *
             * if ( controllerListener.GetJumpDown())
             * {
             *  jump = true;
             * }
             */
        }
        #endregion
    }