Game Development Reference
In-Depth Information
Creating
the
ShowLevel3Results
response
The ShowLevel3Results class will be used to show the success pop up (and
some associated cleanup) if the user achieves enough points. It will be dispatched by
npcDecisionMgr of LevelLogicObj in this level. Perform the following steps to
create the ShowLevel3Results response:
1. Create a new npcResponse class named re-
sponse_ShowLevel3Results . Change the parent class from MonoBeha-
vior to npcResponse .
2. Open the scene file from the last gameplay level TESTBED1 .
3. Copy the popup_Level1Finished Prefab by pressing Ctrl + C .
4. Open the scene file from the last gameplay level TESTBED3 .
5. Paste this GameObject beneath the hierarchy of MainCamera . Rename the
popup_Level3Finish object as shown in the following code:
6. Add an instance of the response_ShowLevel3Results script to
LevelLogicObj .
7. Drag-and-drop a reference to this script into the Response field beside con-
dition_addScore in decisionMgr for LevelLogicObj .
8. Drag-and-drop a reference from popup_Level3Finish (inside the
MainCamera hierarchy) into the passPopup field of the re-
sponse_ShowLevel3Results script instance. In the dispatch() method
of this script, enable the passPopup if it is valid, as shown in the following
code:
if (passPopup != null)
passPopup.SetActive(true);
Search WWH ::




Custom Search