Game Development Reference
In-Depth Information
if (tokenFound == true))
{
missionComplete = false;
break;
}
• ValidateAll() : This methods invokes Validate() on all user-
defined missions if they are not already complete. If any mission is
found to be completed, a reward is instantiated for the player through
the InvokeReward() method, as shown in the following code:
void ValidateAll() {
for (int i = 0; i <
missions.Count; i++)
{
Mission m = missions[i];
// validate missions…
}
}
We will sequentially search through all user-defined missions that
have not already been completed (no need to do this once a mission
is done). This enumeration will be defined in the Mission script, as
shown in the following code:
if (m.status !=
mission.missionStatus.MS_Completed)
{
bool missionSuccess = Validate(m);
If the mission has been validated as being complete, the mission im-
plements an InvokeReward() method to reward the user, as shown
in the following code:
Search WWH ::




Custom Search