Game Development Reference
In-Depth Information
if (ot == io)
{
inventoryObjects[i].quantity++;
// add token from this object to
missionMgr
// to track, if this obj as a token
MissionToken mt =
iObj.gameObject.GetComponent<MissionToken>();
if (mt != null)
missionMgr.Add(mt);
iObj.gameObject.SetActive(false);
inserted = true;
break;
}
}
8. Note, if the types of the object match any existing object on the list, we do
some topic keeping. We increase its number as well as copy the texture ref-
erence that we will display in the inventory. We will also disable the object (to
stop it from rendering and interacting with the world) by setting its active flag
to false and then we leave the loop, as shown in the following code. We will
declare the MissionToken script later in this chapter:
if (ot == io)
{
inventoryObjects[i].quantity++;
missionTokenmt =
iObj.gameObject.GetComponent<MissionToken>();
iObj.gameObject.SetActive (false);
inserted = true;
}
9. An important aspect to note here is that we need to check if there is a Mis-
sionToken script attached to this InteractiveObj . If there is one, then
we will add it to MissionMgr . In this way, we will complete the communica-
tion between the two management systems in this chapter. Later, we will see
Search WWH ::




Custom Search