Game Development Reference
In-Depth Information
1. Drag-and-drop this
A_Coin
object from the
Hierarchy
tab into the
Project
tab, thereby creating a Prefab. Name this Prefab
coin
, as shown in the fol-
lowing screenshot:
2. Create a second interactive object, following the steps 1 to 9 from the
Build-
ing an interactive object
section. Instead of making a yellow coin, create a
red ruby and point the inventory texture to the ruby icon texture provided.
3. Name this object
A_Ruby
and set the mission token ID to
4
.
4. Drag-and-drop
A_Ruby
to the
Project
tab, forming a Prefab named
Ruby
.
5. Drag-and-drop the coin and ruby Prefabs back into the
Hierarchy
tab. At this
point, there should be two coins and two rubies. Set the mission token ID of
the second coin to
2
and the second ruby to
4
.
Now that we have two coins and two rubies, let's create two missions!
1. Click on
MissionMgr
and increase the size of the missions' array to
2
. Note
that the array populates with an empty version of the
Mission
class. Set the
first mission to
activated
and
visible
.
2. Set the first mission state to
MS_ACQUIRED
and name it
Coin Craze
.
3. Set the description to
collect all of the coins
.
4. Set the points to
500
.
5. Under tokens, drag-and-drop the two coin game objects. This will set the ref-
erences to
MissionTokens
attached to the coin Prefabs.
6. Create a reward Prefab out of
GuiText
with
SimpleLifeSpanScript
at-
tached. Set the string to
You have completed the coin challenge
with a
lifespan of 2 seconds. Drag-and-drop this Prefab into the reward field of
mis-
sion 1
in the mission manager. Make sure to delete any instances of this
reward Prefab from the hierarchy; we want
MissionMgr
to spawn this!