Game Development Reference
In-Depth Information
Note
In this step, we've used the ? and : syntaxes. These syntaxes are basically a
shortcut to get variables from the if-else statement. Consider the following
example:
var something;if (condition) { something = true; }
else { something = false; }
We can change this to something like the following code:
var something = (condition) ? true : false;
4. Next, we go back to the Menu script and add the variables as highlighted in the
following code:
// Unity JavaScript user:
var skills : SkillsContainer;
private final var ITEM_BOX_RECT : Rect = new Rect
(237, 67, 360, 247);
private final var ITEM_TIP_BOX_RECT : Rect = new Rect
(237, 330, 360, 107);
private var _scrollPosition : Vector2 = Vector2.zero;
function Start () : void {
// C# user:
public SkillsContainer skills;
readonly Rect ITEM_BOX_RECT = new Rect (237, 67, 360,
247);
readonly Rect ITEM_TIP_BOX_RECT = new Rect (237, 330,
360, 107);
Vector2 _scrollPosition = Vector2.zero;
Search WWH ::




Custom Search