Mecanim animation line up with in game logic?

173 Views Asked by At

In my top-down RPG, I have several enemies like Goblins, Trolls, Dragons,...

Each of them have two variables:

baseAttackDuration = float (how long in seconds does attack take, varies between enemies) increasedAttackSpeed = float (attack speed modifier, may change during combat, also varies between enemies)

So when the character attacks, the duration of the attack equals to: attackDuration = baseAttackDuration / increasedAttackSpeed

Question: Now, how should I set Mecanim to play attack animation so the animation lines up with in game logic and lasts exactly attackDuration?

0

There are 0 best solutions below