-
Notifications
You must be signed in to change notification settings - Fork 42
Animation State Base
Mikhail Albershtein edited this page Apr 5, 2020
·
5 revisions
I needed to combine animation with code to add combo. I found a solution to create StateBase which has a list of StateDatas.
It's a class that extends StateMachineBehaviour which is "mono-behavior for animations". You should add it to the animation
It has three main methods:
- OnStateEnter - executes when the animation starts
- OnStateUpdate - update method
-
OnStateExist - executes while exiting
Each animator has a list ofStateData
which are executing in each stage.
To add a state data to the list of base state data you first need to create it:
Then add the parameters you need:
Let's check this example. For every attack animation, we have to create a state because each attack should have its own damage and damage type.
I found this idea from this amazing dude - Roundbeargames Choi