protected void UpdateBaseAnimation( string animationBaseName, bool allowRandomAnimationNumber,
bool loop, float velocity)
{
if( forceAnimationRemainingTime != 0 )
Log.Fatal( "Dynamic: UpdateBaseAnimation: forceAnimationRemainingTime != 0." );
if( currentAnimationItem != null )
{
if (currentAnimationItem.Loop == true)
{
// The new animation is different from the last animations
if(currentAnimationItem.Removed ||
currentAnimationItem.AnimationBaseName != animationBaseName ||
currentAnimationItem.AllowRandomAnimationNumber != allowRandomAnimationNumber ||
currentAnimationItem.Loop != loop)
{
animationController.Remove(currentAnimationItem);
currentAnimationItem = null;
}
}
else
{
if (// The new animation is different from the last animations
(currentAnimationItem.Removed ||
currentAnimationItem.AnimationBaseName != animationBaseName ||
currentAnimationItem.AllowRandomAnimationNumber != allowRandomAnimationNumber ||
currentAnimationItem.Loop != loop) &&
// and the animation has stopped playing
currentAnimationItem.TimePosition == currentAnimationItem.Length)
{
animationController.Remove(currentAnimationItem);
currentAnimationItem = null;
}
}
}
if( currentAnimationItem == null )
{
currentAnimationItem = animationController.Add( animationBaseName,
allowRandomAnimationNumber, loop );
if (currentAnimationItem != null)
currentAnimationItem.Velocity = velocity;
}
}