Пример #1
0
    void Update()
    {
        // Store the input axes.
        GetH = Input.GetAxis("Horizontal");
        GetV = Input.GetAxis("Vertical");

        // Set the input axes on the Animator Controller.
        GetAnim.SetFloat(hFloat, GetH, 0.1f, Time.deltaTime);
        GetAnim.SetFloat(vFloat, GetV, 0.1f, Time.deltaTime);

        // Toggle sprint by input.
        sprint = Input.GetButton(sprintButton);

        // Set the correct camera FOV for sprint mode.
        if (IsSprinting())
        {
            changedFOV = true;
            GetCamScript.SetFOV(sprintFOV);
        }
        else if (changedFOV)
        {
            GetCamScript.ResetFOV();
            changedFOV = false;
        }
        // Set the grounded test on the Animator Controller.
        GetAnim.SetBool(groundedBool, IsGrounded());
    }
Пример #2
0
 private void OnDisable()
 {
     rBody.constraints = RigidbodyConstraints.FreezeAll;
     GetAnim.SetFloat("Speed", 0f, 0f, Time.deltaTime);
 }