void FALLUpdate()
 {
     if (trainerControl)
     {
         if (PhysicsCalculations.IsGrounded(trainer.components.collider, 0.1f, trainer.colliderRadius))
         {
             currentState = States.IDLE;
             return;
         }
     }
     else
     {
         if (PhysicsCalculations.IsGrounded(pokemon.components.collider, 0.1f, pokemon.colliderRadius))
         {
             pokemon.components.anim.Land();
             currentState = States.IDLE;
             return;
         }
     }
 }
 void IDLEUpdate()
 {
     if (trainerControl)
     {
         if (trainer.components.input.curInput.jump)
         {
             currentState = States.PRE_JUMP;
             return;
         }
         if (!PhysicsCalculations.IsGrounded(trainer.components.collider, 0.1f, trainer.colliderRadius))
         {
             currentState = States.FALL;
             return;
         }
         if (trainer.components.input.curInput.movement != Vector3.zero)
         {
             currentState = trainer.components.input.curInput.walk ? States.WALK : States.RUN;
             return;
         }
     }
     else
     {
         if (pokemon.components.input.curInput.jump && canMove)
         {
             currentState = States.PRE_JUMP;
             return;
         }
         if (!PhysicsCalculations.IsGrounded(pokemon.components.collider, 0.1f, pokemon.colliderRadius))
         {
             currentState = States.FALL;
             return;
         }
         if (pokemon.components.input.curInput.movement != Vector3.zero && canMove)
         {
             currentState = pokemon.components.input.curInput.walk ? States.WALK : States.RUN;
             return;
         }
     }
 }
    void FixedUpdate()
    {
        if (trainerControl)
        {
            if (lookDirection != Vector3.zero)
            {
                trainer.components.rigidbody.rotation = Quaternion.LookRotation(lookDirection);
            }

            velocityChange   = targetVelocity - trainer.components.rigidbody.velocity;
            velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
            velocityChange.y = 0.0f;
            velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);
            trainer.components.rigidbody.AddForce(velocityChange, ForceMode.VelocityChange);

            if (!PhysicsCalculations.IsGrounded(trainer.components.collider, 0.1f, trainer.colliderRadius))
            {
                trainer.components.rigidbody.AddForce(new Vector3(0.0f, -trainer.gravity * trainer.components.rigidbody.mass, 0.0f));
            }
        }
        else
        {
            if (lookDirection != Vector3.zero)
            {
                pokemon.components.rigidbody.rotation = Quaternion.LookRotation(lookDirection);
            }

            velocityChange   = targetVelocity - pokemon.components.rigidbody.velocity;
            velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange);
            velocityChange.y = 0.0f;
            velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange);
            pokemon.components.rigidbody.AddForce(velocityChange, ForceMode.VelocityChange);

            if (!PhysicsCalculations.IsGrounded(pokemon.components.collider, 0.1f, pokemon.colliderRadius))
            {
                pokemon.components.rigidbody.AddForce(new Vector3(0.0f, -pokemon.gravity * pokemon.components.rigidbody.mass, 0.0f));
            }
        }
    }
 void RUNUpdate()
 {
     if (trainerControl)
     {
         if (trainer.components.input.curInput.walk)
         {
             currentState = States.WALK;
             return;
         }
         if (trainer.components.input.curInput.jump)
         {
             currentState = States.PRE_JUMP;
             return;
         }
         if (!PhysicsCalculations.IsGrounded(trainer.components.collider, 0.1f, trainer.colliderRadius))
         {
             currentState = States.FALL;
             return;
         }
         if (trainer.components.input.curInput.movement != Vector3.zero)
         {
             targetVelocity = trainer.components.input.curInput.movement * trainer.walkSpeed * trainer.runMultiplier;
         }
         else
         {
             currentState = States.IDLE;
             return;
         }
     }
     else
     {
         if (!canMove)
         {
             currentState = States.IDLE;
             return;
         }
         if (pokemon.components.input.curInput.walk)
         {
             currentState = States.WALK;
             return;
         }
         if (pokemon.components.input.curInput.jump)
         {
             currentState = States.PRE_JUMP;
             return;
         }
         if (!PhysicsCalculations.IsGrounded(pokemon.components.collider, 0.1f, pokemon.colliderRadius))
         {
             currentState = States.FALL;
             return;
         }
         if (pokemon.components.input.curInput.movement != Vector3.zero)
         {
             targetVelocity = pokemon.components.input.curInput.movement * pokemon.CurWalkSpeed * pokemon.runMultiplier;
         }
         else
         {
             currentState = States.IDLE;
             return;
         }
     }
 }