Skip to content

Animation State Base

Mikhail Albershtein edited this page Apr 5, 2020 · 5 revisions

Purpose

I needed to combine animation with code to add combo. I found a solution to create StateBase which has a list of StateDatas.

Animation State Base

It's a class that extends StateMachineBehaviour which is "mono-behavior for animations". You should add it to the animation state base component
code

It has three main methods:

  • OnStateEnter - executes when the animation starts
  • OnStateUpdate - update method
  • OnStateExist - executes while exiting
    Each animator has a list of StateData which are executing in each stage.

State Data

code

To add a state data to the list of base state data you first need to create it:

create state

Then add the parameters you need:

combo attack parameters

Example - attack

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.

combo attack state

Credits

I found this idea from this amazing dude - Roundbeargames Choi