Game Development Reference
In-Depth Information
Step 43: Apply these changes to the prefab. With FPC_AegisChung selected
in the Hierarchy, in the Inspector click the Apply button on the Prefab line.
Why?
We want to make sure that all this work on the inventory system is
functional in the Hallway too (and any other levels we create). By applying
the changes to the prefab, we know that these new functionalities will
work later as well.
Bulking up the GUI System
We need to solve a couple of problems with our inventory system. First we
don't want it visible all the time; with it always there, it detracts from the
immersive experience and the player assumes he can reach up and select
a tool. The second problem is that we don't want the mouse visible usually.
It'd be necessary to have it visible when selecting tools, but it needs to go
away when the game is running in noninventory mode. We'll solve both of
these problems by authoring a couple of new functions to show and hide the
inventory.
But before we go too far, let's clean up, expand, and make a prefab of all our
GUIElements to clean up our Hierarchy, and make the elements more easily
accessible and reusable.
Step 44: Create a new GUITexture (GameObject>Create Other>GUI
Texture). Name it InventoryPrompt. Use ButtonInventory-Tab-Horizontal
(from the Project panel's 2D Assets) for the Texture. Change the Transform
X = 0 and Transform Y = 1 . Change the Pixel Inset to X = 0 , Y = -32 ,
Width = 256 , Height = 32.
Why?
This GUITexture will serve as the prompt to remind the player how to
access the inventory.
Step 45: Make InventoryButton_EMP, InventoryButton_Flashlight,
and Inventory_Button_Pistol children of InventoryButton_Tab (in
the Hierarchy, select these three GUITextures and drag them atop
InventoryButton_Tab).
Why?
We are going to use iTween's MoveTo to move all the buttons on
and off en masse. By making the buttons a child of one element (the
InventoryButton_Tab), we can animate just the tab, and all the buttons
will go with it.
Search WWH ::




Custom Search