Game Development Reference
In-Depth Information
cess to more free animations, we would look for the one that conveyed dis-
appointment).
If a correct animation is chosen, QuizNpc will dance! To begin, drag-and-
drop the Gangnam dance animation from the anims folder into the Animat-
or window.
8. Create a transition from the Idle state to the Gangnam dance state by right-
clicking on Idle , selecting Make Transition , and then left-clicking on Gang-
nam to complete the transition.
9. Click on the small + sign beside Parameters and create a new parameter
named success of the type Boolean. We will use this to trigger the success
animation from the script.
10. Left-click on the small white triangle of the transition and change the trans-
ition conditions to Success and True .
11. Drag-and-drop the QuizNpc GameObject back to the top of the QuizNpc
Prefab in the Project tab. This will overwrite the pre-existing one with our
new updates.
Note
Make sure not to drag-and-drop the QuizNpc GameObject to the top of a
different Prefab or else you will lose your other work!
12. We are going to need a new PopupButton action. Add another entry to the
popupAction enumeration in PopupButtonScript.cs :
MakeNpcDance = 13
13. Add the following implementation of this action in the dispatch method of
PopupButtonScript . If this action is dispatched, then find the NPC that
has an ID that matches the ID of this correct pop-up card (passed through
the side data of the pop-up response r ), and set the doSuccess parameter
on that NPC to true .
14. We do this by searching for all QuizNpcHelpers and then comparing the
ID with the one requested from this pop up.
Search WWH ::




Custom Search