Game Development Reference
In-Depth Information
public int numEntries;
public npcCondition data;
26. Drag-and-drop
listData
from the
LevelLogicObj
GameObject to the
data field on
condition_listFull
.
27. Inside the implementation of
eval()
,
condition_isFull
does its work.
If data is not null, it extracts the number of entries from the listData's list
through its count member as shown in the following code:
if (data != null)
{
int count = (data as
listData)._listData.Count;
28. If the count of the
listData
component's list array equals the
numEntries
value on this script, the return value is set to
true
. Otherwise, it remains
false
as shown in the following code snippet:
if (count == numEntries)
rval = true;
29. Now that
condition_listFull
is complete, let's create the response
that will occur when the list is found to be true—
re-
sponse_ShowRaceResultsPopup
. This script will check the status of the
mission, and enable the correct pop up on the main camera to achieve the
desired gameflow.
30. Create a new script named
response_ShowRaceResultsPopup
, change
its base class to
npcResponse
, and add an instance of it to
LevelLo-
gicObj
.
31. Add the following five public member variables to this script:
• An npcCondition named
data
• A GameObject named
player
• A gameMgr named
gm
• A GameObject named
passPopup
• A GameObject named
retryPopup