void OnTriggerEnter(Collider col) { // Destroy object? if (DestroyObjectUponEnter) { Destroy(col.gameObject); } // Reset lever? try{ _lever.StartCoroutine("Reset"); } catch {} // Open/close door? try{ _door.StartCoroutine("MoveDirection"); } catch {} // Change nearby light(s)? try{ TLCColor1.StartCoroutine("switchColor"); }catch {} try{ TLCColor2.StartCoroutine("switchColor"); }catch {} try{ TLCColor3.StartCoroutine("switchColor"); }catch {} // Stop production of Producer? try { _producer.stopProduction = true; } catch {} }
void Update() { RaycastHit hit; bool isLookedAt = GetComponent <Collider>().Raycast(head.Gaze, out hit, Mathf.Infinity); GetComponent <Renderer>().material.color = isLookedAt ? Color.green : Color.red; if ((Cardboard.SDK.CardboardTriggered && isLookedAt)) { //Debug.Log (GetComponent<Collider>()); lm.StartCoroutine("FlipState"); } }