void Start() { PrefabManager.LoadPrefabs(); Color color = new Color(61 / 255f, 127 / 255f, 219 / 255f, 0.5f); for (int i = 0; i < 15; i++) { GUITexture texture = ((GameObject)Instantiate(PrefabManager.UIScreenText)).GetComponent <GUITexture>(); texture.texture = PrefabManager.PrefabTopPanelText[' ']; texture.color = color; texture.pixelInset = Constants.getRectToScreen(-290 + i * 38, 225, 40, 48); characters[i] = texture; } UnityEngine.Object[] buttons = FindObjectsOfType(typeof(IPButton)); foreach (UnityEngine.Object obj in buttons) { IPButton button = (IPButton)obj; dictionary.Add(button.key, button); } }
void UpdateLookingAt() { RaycastHit hit; if (!Physics.Raycast(cam.position, cam.forward, out hit)) { if (lastLookedAt) { lastLookedAt.SetNormal(); } } else if (hit.transform.name == "Button") { IPButton lookedAt = hit.transform.GetComponent<IPButton>(); if(lastLookedAt && lookedAt != lastLookedAt) lastLookedAt.SetNormal(); lookedAt.SetEmissive(); if (Input.GetMouseButtonDown(0)) AddStr(lookedAt.str); lastLookedAt = lookedAt; } }