AnimationController
Introduction
AnimationController Benefits
// Assuming "this" is a character entity
string animationToSet = null;
const float minMovementForWalkAnimation = 1;
if(IsTakingDamage)
{
if(this.Direction == Direction.Left)
{
animationToSet = "TakeDamageLeft";
}
else
{
animationToSet = "TakeDamageRight";
}
}
else if(Math.Abs(this.XVelocity) > minMovementForWalkAnimation)
{
if(this.Direction == Direction.Left)
{
animationToSet = "WalkLeft";
}
else
{
animationToSet = "WalkRight";
}
}
else
{
if(this.Direction == Direction.Left)
{
animationToSet = "IdleLeft";
}
else
{
animationToSet = "IdleRight";
}
}Using AnimationLayer for Animation Logic
Modifying Layer Order
Last updated
Was this helpful?