Game Development Reference
In-Depth Information
m.displayName = "MissionOne";
m.description = "collect the 5 randomly
placed flags";
11. For this mission, we instance the five selected flags, place them at the selec-
ted
spawnpoint
, and add them to the
MissionMgr
. Then we add the five
MissionToken
script instances (one from each flag Prefab instance) to the
mission. This associates picking up each flag instance with the objectives of
the first mission as shown in the following code:
Vector3 flagPos =
activeSpawnPoints[k].transform.position;
GameObject flagInstance =
(GameObject)Instantiate
(flagPrefab, flagPos, new
Quaternion(0.0f, 0.0f, 0.0f,
1.0f));
m.tokens.Add
(flagInstance.GetComponent<missionToken>());
12. The second mission is set acquired, visible, and active as shown in the fol-
lowing code:
m.activated = false;
m.visible = false;
m.status =
mission.missionStatus.MS_Acquired;
13. It is also given a
displayName
and
description
as shown in the following
code:
m.displayName = "MissionTwo";
m.description = "return the flags to the
flagstand";
14. All of the
MissionTokens
from mission one are added to mission two as
well. Since mission two starts with one
MissionToken (id=10)
in the in-
spector, the total number of tokens for mission two is equal to six. This last
token corresponds to the user taking the five flags back to the monument (the