void Start() { canvas = transform.GetComponentInChildren <RectTransform> (); text = canvas.GetComponentInChildren <Text> (); InitializeCamera cameraSetup = initialCanvas.GetComponent <InitializeCamera> (); int index = InitializeCamera.index; camera = cameras [index]; //canvas = transform.GetComponentInChildren<RectTransform> (); //text = canvas.GetComponentInChildren<Text> (); prototype = transform.GetComponentInParent <PrototypeStates> (); originalScale = prototype.originalScale; hidden = new Vector3(0.0f, 0.0f, 1.0f); canvas.localScale = hidden; text.enabled = false; isOn = false; }
private void gazeTrigger2() { Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0)); RaycastHit hit; if (Physics.Raycast(ray, out hit, 18.0f, myLayerMask)) { prototype = hit.collider.gameObject.GetComponentInParent <PrototypeStates> (); prototype.focusSound = true; if (prototype.archived == true) { text = hit.collider.gameObject.GetComponentInParent <textDisplay> (); turnTextOn(); timer += Time.deltaTime; reticle.fillAmount += 1.0f / triggerTime * Time.deltaTime; } if (timer > triggerTime) { detritusGO.GetComponent <DetritusManager> ().spawnDetritus(); timer = 0.0f; StartCoroutine(FadeReticle(0.0f, 0.7f)); turnTextOff(); prototype.archived = false; prototype.movingUp = true; } } else if (text != null) { prototype.focusSound = false; reticle.fillAmount = 0; timer = 0.0f; turnTextOff(); } else if (prototype != null) { prototype.focusSound = false; prototype = null; } }