示例#1
0
    private static float Refresh(AnimatorManager animatorManager, float timeOutTimer)
    {
        const float epsilon = 0.0001f;

        if (!Input.anyKeyDown && Math.Abs(Input.GetAxis("Mouse X")) < epsilon && Math.Abs(Input.GetAxis("Mouse Y")) < epsilon &&
            !animatorManager.GetBoolAnimator("talk"))
        {
            return(timeOutTimer);
        }
        // If the user is active but the state is still in timeout, walk back in screen.
        if (animatorManager.GetBoolAnimator("timeout"))
        {
            animatorManager.SetBoolAnimator("timeout", false);
            // Do something on activation after timeout, may be inserted later
        }
        // Allow for moving the avatar with controls instead of only with animations.
        if (!animatorManager.GetApplyRootMotionAnimator() &&
            animatorManager.GetCurrentAnimatorStateInfoAnimator(0).IsName("idle"))
        {
            animatorManager.SetApplyRootMotionAnimator(true);
        }

        return(0f);
    }