Game Development Reference
In-Depth Information
if (missionSuccess == true)
{
m.InvokeReward();
}
Implementing the Mission script
The Mission class is the container for MissionTokens . It implements a state that
helps us specialize how a mission should be treated by the game (for instance, we
may want to have the player acquire a mission but not start it). This class has a
number of state variables for future extension such as activated , visible , and
points .
1. As with the InventoryItem class, the Mission class is a helper class that
only the MissionMgr class uses. Hence, it does not inherit from monobe-
havior . Therefore, the class signature must include the [Sys-
tem.Serializable] tag as before:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[System.Serializable]
public class Mission {
2. This class also implements an enumeration to describe the state of a partic-
ular mission. This is used to encode whether a state is invalid, acquired, in
progress, or solved so that MissionMgr can handle the mission appropri-
ately, as shown in the following code:
public enum missionStatus
{
MS_Invalid = -1,
MS_Acquired = 0,
MS_InProgress = 1,
MS_Completed = 2
};
Search WWH ::




Custom Search