Game Development Reference
In-Depth Information
Engage thrusters
We will begin by creating the menu using the following steps:
1. First, we want to create an empty game object in our scene and name it menu ; go
to GameObject | Create Empty and name it MenuObject and set its Tag and
Layer to UI . We will use this object for our menu.
2. Next, we will create the menu script that will control our entire menu; go to Assets
| Create | Javascript (for Unity JavaScript users) or Assets | Create | C# (for C#
users), name it Menu , double-click on it to launch MonoDevelop , and we will get
our hands dirty with the code.
3. Open the Menu script file and type the following variables:
// Unity JavaScript user
#pragma strict
public enum TAB {STATUS,INVENTORY,EQUIPMENT};
var customSkin : GUISkin;
var heroTexture : Texture;
var statBox1Texture : Texture;
var statBox2Texture : Texture;
var skillBoxTexture : Texture;
private final var TOOLBARS : String[] =
[ TAB.STATUS.ToString(), TAB.INVENTORY.ToString(),
TAB.EQUIPMENT.ToString() ];
private final var HERO_RECT : Rect = new Rect (19, 35,
225, 441);
private final var CLOSE_BTN_RECT : Rect = new Rect
(598, 8, 26, 22);
private final var TAB_BTN_RECT : Rect = new Rect (35,
15, 480, 40);
private var _currentTool : TAB = TAB.STATUS;
private var _windowRect : Rect = new Rect (10, 10,
640, 480);
private var _isMenuOpen : boolean = false;
Search WWH ::




Custom Search