コード例 #1
0
    void Update()
    {
        Vector3 camForward = camTransform.forward;

        camForward.y = 0;
        camForward.Normalize();

        moveDirection = camForward * moveInput.y + camTransform.right * moveInput.x;

        float stickStrength = moveDirection.magnitude;

        anim.SetFloat(MoveInputMagnitude, stickStrength);
        anim.SetFloat(MoveInputWithWarmUp, stickStrength + warmUpBoost);
        if (!crouch && wasGrounded)
        {
            velocityBar.value = stickStrength + warmUpBoost;
        }
        else
        {
            velocityBar.value = 0f;
        }

        bool crouchEffect = crouch && rigidbody.velocity.sqrMagnitude > 0.01f;

        playerFX.CheckCrouchEffects(stickStrength > data.runThreshold || crouchEffect, crouchEffect, wasGrounded);
    }