Game Development Reference
In-Depth Information
The preceding steps attaches our new battle state machine to our battle engine. Now, we
just need to be able to reference the BattleStateMachine Mecanim state machine from
BattleManager script. To do this, open up the BattleManager script in As-
sets\Scripts and add the following variable to the top of the class:
private Animator battleStateManager;
Then, to capture the configured Animator component in our BattleManager script,
we add the following to the Start function:
void Start () {
battleStateManager = GetComponent<Animator>();
Note
Sadly, we have to assign it this way because all the functionality to interrogate the Anim-
ator Controller is built in to the Animator component. We cannot simply attach the
controller directly to our BattleManager script and use it.
Now that it's all wired up, let's start using it.
Search WWH ::




Custom Search