Game Development Reference
In-Depth Information
Building a quiz racer animation FSM
Let's build an FSM that the
QuizNpc
Prefabs in
mission 2
will use. Again, let's
develop the locomotion system to start.
1. Drag-and-drop an instance of the
QuizNpc
Prefab from the project library
window into the scene.
2. Drag-and-drop an instance of the
Alexis
model (already downloaded) and
place it beside
QuizNpc
. Disable the mesh renderer on
QuizNpc
so that it
no longer renders, and parent the
Alexis
model to the
QuizNpc
GameOb-
ject.
3. Set
Alexis'
local position to (
0
,
-1
,
0
).
4. Create a new
AnimatorController
named
QuizNpcController
. Drag-
and-drop this controller from the
Project
pane directly into the
Animat-
orController
field on the
QuizNpc
instance.
5. Select
QuizNpc
and then open the
Animator
panel to preview the empty
FSM.
6. Drag-and-drop the
Idle
animation from the
anims
folder into the the panel.
7. The idle animation will play by default. When the player approaches
QuizNpc
, a pop up will be displayed. If an incorrect answer is chosen, this
will have no bearing on the NPC's animation (although ideally, if we had ac-