//public delegate void FunctionHandler(); //Dictionary<string, FunctionHandler> commands = new Dictionary<string, FunctionHandler>(); void Awake() { //commands.Add("GUISaveAndExit", GUISaveAndExit); pc = GetComponent<PlayerController>(); pi = GetComponent<PlayerInfo>(); vi = GameObject.Find("Vault").GetComponent<VaultInfo>(); foreach (GameObject obj in GameObject.FindGameObjectsWithTag("MyGUI")) { GUIContainer container = obj.GetComponent<GUIContainer>(); if (container) container.playerGUI = this; } // Setup GUI Var Transform _t = GameObject.Find("PlayerGUIContainer").transform; for (int i = 0; i < _t.childCount; i++) { Transform stk = _t.GetChild(i); if (stk.name == "Stack") inventory.Add(stk.GetComponent<GUIBlock>()); } inventoryMenu = _t.FindChild("InventoryMenu").GetComponent<GUIContainer>(); pauseMenu = _t.FindChild("PauseMenu").GetComponent<GUIContainer>(); charBlock = _t.FindChild("Character").GetComponent<GUIBlock>(); exit = _t.FindChild("SaveAndExit").GetComponent<GUIBlock>(); age = _t.FindChild("Age").GetComponent<TextMesh>(); roomHealth = _t.FindChild("RoomHealth").GetComponent<TextMesh>(); hunger = _t.FindChild("Hunger").GetComponent<TextMesh>(); health = _t.FindChild("Health").GetComponent<TextMesh>(); radiation = _t.FindChild("Radiation").GetComponent<TextMesh>(); suitBar = _t.FindChild("Suit"); suitBarStartWidth = suitBar.localScale; // End Setup }
public void Click(GUIBlock block, int button) { activeBlock = block; Debug.Log("Click " + button); if (button == 0) { //commands["GUI" + block.name](); Invoke("GUIClick" + block.name, 0); } else if (button == 1) { Invoke("GUIRClick" + block.name, 0); } else if (button == 2) { Invoke("GUIMClick" + block.name, 0); } }
public void DragUp(GUIBlock block) { activeBlock = block; Color curr = activeBlock.renderer.material.color; activeBlock.renderer.material.color = new Color(curr.r, curr.g, curr.b, 255); Debug.Log("DragUp"); Invoke("GUIDragUp" + block.name, 0); }