예제 #1
0
    /// <summary>
    /// Raises the player’s move event on the server if the corresponding keys are pressed.
    /// </summary>
    private void PlayerMovement()
    {
        if (!IsJump && Input.GetButtonDown("Jump"))
        {
            CmdJump();
        }

        if (IsJump)
        {
            AnimatorController.SetJumpState();
        }

        if (Input.GetButton("Horizontal") || Input.GetButton("Vertical"))
        {
            float Horizontal = Input.GetAxis("Horizontal");
            float Vertical   = Input.GetAxis("Vertical");

            if (Input.GetButton("Sprint"))
            {
                CmdSprint(Horizontal, Vertical);
                AnimatorController.SetSprintState();
            }
            else
            {
                CmdWalk(Horizontal, Vertical);
                AnimatorController.SetWalkState();
            }

            AnimatorController.SetMovementState();
        }
        else
        {
            AnimatorController.SetIdleState();
        }
    }