Game Development Reference
In-Depth Information
Create | C# (for C# users), name it ItemsContainer , double-click on it to
launch MonoDevelop , and replace the code as follows:
// Unity JavaScript user:
#pragma strict
class ItemsContainer {
private final var UNEQUIP : String = "UNEQUIP";
private final var NONE : String = "NONE";
private var _guiContent : GUIContent;
private var _isEquipment : boolean;
function get guiContent () : GUIContent {
return _guiContent;
}
function Init ( isEquipment : boolean ) : void {
_isEquipment = isEquipment;
_guiContent = (_isEquipment) ? new
GUIContent(UNEQUIP) : new GUIContent(NONE);
}
}
// C# user (put the code inside the class):
using UnityEngine;
using System.Collections;
[System.Serializable]
public class ItemsContainer {
const string UNEQUIP = "UNEQUIP";
const string NONE = "NONE";
GUIContent _guiContent;
bool _isEquipment;
public GUIContent guiContent {
get { return _guiContent; }
}
public void Init ( bool isEquipment ) {
_isEquipment = isEquipment;
_guiContent = (_isEquipment) ? new
GUIContent(UNEQUIP) : new GUIContent(NONE);
Search WWH ::




Custom Search