PlayerScript.UpdateRemoteMovement C# (CSharp) Méthode

UpdateRemoteMovement() private méthode

private UpdateRemoteMovement ( ) : void
Résultat void
    private void UpdateRemoteMovement()
    {
        bool seemsGrounded = CheckOverlap(transform.position - new Vector3(0, 1f, 0));
        bool wasInAir = sinceNotGrounded >= 0.1f;
        sinceNotGrounded = seemsGrounded ? 0f : sinceNotGrounded + Time.deltaTime;

        if( seemsGrounded )
        {
            if( MathHelper.AlmostEquals( ImpliedInputVelocity, Vector3.zero, 0.1f ) && currentAnim != "idle" )
                    characterAnimation.CrossFade( currentAnim = "idle", IdleTransitionFadeLength );
            else
            {
                var xDir = Vector3.Dot( ImpliedInputVelocity, transform.right );
                var zDir = Vector3.Dot( ImpliedInputVelocity, transform.forward );

                const float epsilon = 15f;

                if (zDir > epsilon)
                {
                    if (currentAnim != "run")
                        characterAnimation.CrossFade(currentAnim = "run", IdleTransitionFadeLength );
                }
                else if (zDir < -epsilon)
                {
                    if (currentAnim != "backward")
                        characterAnimation.CrossFade(currentAnim = "backward", IdleTransitionFadeLength );
                }
                else if (xDir > epsilon)
                {
                    if (currentAnim != "strafeRight")
                        characterAnimation.CrossFade(currentAnim = "strafeRight", IdleTransitionFadeLength );
                }
                else if (xDir < -epsilon)
                {
                    if (currentAnim != "strafeLeft")
                        characterAnimation.CrossFade(currentAnim = "strafeLeft", IdleTransitionFadeLength );
                }
            }
            if (wasInAir)
                landingSound.Play();
        }
        else if (currentAnim != "jump")
        {
            characterAnimation.CrossFade(currentAnim = "jump", IdleTransitionFadeLength );
        }
        UpdateRemoteDashVelocity();
    }