void updateAnimation()
{
if(throwing || parrying) {
//play("throw");
} else if(hurt) {
if(velocity.Length() < HIT_STOP_SPEED &&
currentAnimation != "hurtFall" &&
currentAnimation != "hurtRecover") {
velocity.X = velocity.Y = 0;
if(Dead) play("hurtFall");
else play("hurtRecover");
animation.reset();
}
} else if(Math.Abs(velocity.X) > Math.Abs(velocity.Y)) {
if(velocity.X > MIN_RUN_SPEED) play("run" + forwardOn(onLeft));
else if(velocity.X < -MIN_RUN_SPEED) play("run" + forwardOn(onRight));
else play("idle");
} else {
if(velocity.Y > MIN_RUN_SPEED) {
play("runDown" + (velocity.X < 0 ? forwardOn(onRight) : forwardOn(onLeft)));
} else if(velocity.Y < -MIN_RUN_SPEED) {
play("runUp" + (velocity.X < 0 ? forwardOn(onRight) : forwardOn(onLeft)));
} else play("idle");
}
if(!SPECIAL_ANIMATIONS.Contains(currentAnimation)) {
animation.FPS = velocity.Length() / 14f;
}
}