Game Development Reference
In-Depth Information
The Mecanim animator graph defines all the possible animation states for the mesh,
and these should correspond to the enemy states already outlined, namely, idle,
patrol, chase, attack, and flee. To configure the animations for these states, select the
Constructor
mesh asset in the
Project
panel and make all animations loopable by
enabling the
Loop Time
and
Loop Pose
checkboxes in the Object Inspector, as shown
in the following screenshot. This prevents the character animations from stopping
after playing only once:
Preparation of animation assets for a Mecanim FSM
Now, let's add animation states to the graph, one animation per state. For the
Idle
state, the idle animation should play. For the
Patrol
state, the walk animation should
play as the character should be walking around. For the
Chase
and
Flee
states, the
run animation should play, and for the
Attack
state, the jump animation should play.
The
Constructor
model lacks a dedicated animation for attacks, so (for this sample)
the jump animation will suffice as an attack animation.