Game Development Reference
In-Depth Information
For now, create five triggers:
Idle
,
Patrol
,
Chase
,
Attack
, and
SeekHealth
,
as shown here:
Creating a Trigger variable for each animation state
With both the states and triggers created, the connection between the states in the
graph can now be defined more precisely. Specifically, the
Idle
state should change
to the
Patrol
state when the trigger
Patrol
is activated, the
Patrol
to the
Chase
state
when trigger
Chase
is activated, the
Chase
state to the
Attack
state when trigger
Attack
is activated, and so on. In addition, there's a two-way linkage between most
states:
Patrol
can transition to
Chase
(such as when the enemy sees the player) and
Chase
can transition back to
Patrol
(when the enemy loses sight of the player).
To create connections between states, right-click on a state, select
Make Transition
from the context menu, and then click on the destination state to which a connection
should be made.