Game Development Reference
In-Depth Information
Modifying the LevelLogicObj object
The
LevelLogicObj
object will track the condition when the player has achieved a
high score that is enough to earn the
level finished
pop up and to win the game.
To implement this with the technology we already have, we will perform the following
steps:
1. In
decisionMgr
of
npcScript
on
LevelLogicObj
, set the number of in-
teractions to
2
. This is required because the
LevelLogicObj
object will pro-
cess two interactions each frame.
2. Create an instance of a
floatData
condition on
LevelLogicObj
. Drag-
and-drop this into the first condition. Make sure there is only one instance of
this script on this object in the editor.
3. Create an instance of the
condition_addScore
condition on
LevelLo-
gicObj
. Drag-and-drop this into the second condition. Set the
scoreAdded
variable on the condition to
2500
, and drag-and-drop the
setupLevel3
ob-
ject into the
initalValue
reference to associate the
initialValue
condi-
tion component attached there into this component.
4. Create an instance of the
response_ShowLevel3Results
script on
LevelLogicObj
.
Set
the
reference
to
the
passPopup
popup_Level3Finished
pop up on the
MainCamera
.
5. Drag-and-drop this reference into the reference slot on the second interaction
in
npcDecisionMgr
of the NPC script of
LevelLogicObj
.
At this point,
npcDecisionMgr
on the
LevelLogicObj
object should look
something like the following: