I use timeline to make cutscene in my game. However, my game has different skins for the player character and they have different idle animations. Thus, in the timeline, I can't simply just ask the SkeletonAnimation to play Idle because when character is Archer, it is suppose to play "Archer/Idle", it goes on for other skins like Knight, Mage, etc.
I guess I need way to hook and intercept the animation name and modifying it before it is passing down to actually play animation routine.
Something that in my mind is to provide a simple function that override the original name from the timeline. Every time spine play an anime, it will call this function (if set) to update to the actual name of the animation being played.
spineObj.SetAnimationNameTranslator(animName => {
if (animName == "Idle")
{
switch (MyUnit.job)
{
case Jobs.Warrior: animName = "Warrior/Idle"; break;
case Jobs.Mage: animName = "Mage/Idle"; break;
case Jobs.Archer: animName = "Archer/Idle"; break;
// and so on...
}
}
return animName;
});