Game Development Reference
In-Depth Information
Creating the AddScore condition
The AddScore condition will be used by levelLogicObj to track the points earned
in this mission. Once the requisite number of points have been earned, this script will
return true . This, in turn, will dispatch the response of showing the Success pop up
via the ShowLevel3Results response script. Writing this script requires the follow-
ing steps to be performed:
1. Create a new script named condition_scoreAdded . Change the base
class from MonoBehavior to npcCondition as done with the other condi-
tion classes.
2. Add an instance of this script to LevelLogicObj .
3. Drag-and-drop this script instance into the second slot of decisionMgr on
LevelLogicObj as shown in the following code:
4. Inside the script, add an int datatype for scoreAdded ; this is the number of
points necessary for the condition to return true :
public int scoreAdd;
5. Add an npcCondition called initialScore . Drag-and-drop the instance
of this script from setupLevel3 (remember the object that first stored the
score on level start) into this reference as shown in the following code:
Search WWH ::




Custom Search