Game Development Reference
In-Depth Information
if(theYellowKey)
GUI.Box (Rect (160,42,35,35), yellowkey);
else
GUI.Box (Rect (160,42,35,35), greykey);
if(theGreenKey)
GUI.Box (Rect (200,42,35,35), greenkey);
else
GUI.Box (Rect (200,42,35,35), greykey);
GUI.EndGroup ();
}
Step 20. Attach this script to the Main Camera.
Step 21. Select the Main Camera in the Hierarchy and locate the
script in the Inspector. The script requires five images to be added
for the values of the colored keys. A file called Chapter Six/keys.zip
with the images for these can be downloaded from the Web site
or you can create your own. Place the key images in the Project
and drag each over to the Inspector to match the places in the
script as shown in Figure 6.9 . This script allows for an inventory of
four keys.
FIG 6.9 Adding images for the keys
into the GUI.
Search Nedrilad ::




Custom Search