void Update() { // Check if the Head gaze direction is intersecting any of the ViewTriggers RaycastHit hit; Ray cameraGaze = new Ray(this.transform.position, this.transform.forward); Physics.Raycast(cameraGaze, out hit, Mathf.Infinity); if (hit.collider) { if (hit.collider.gameObject.GetComponent <ViewTrigger> ()) { ViewTrigger trigger = hit.collider.gameObject.GetComponent <ViewTrigger> (); trigger.Focused = true; } if (hit.collider.gameObject.GetComponent <GazeTrigger> ()) { GazeTrigger trigger = hit.collider.gameObject.GetComponent <GazeTrigger> (); trigger.Focused = true; } } /*foreach (var trigger in viewTriggers) * { * trigger.Focused = hit.collider && (hit.collider.gameObject == trigger.gameObject); * }*/ }
public void ChangeSelectedObject(ViewTrigger button, GameObject select) { selectedObject = select; if (button != null) { if (currentButton != null) { currentButton.ResetButton(); } currentButton = button; } }
internal void command(ViewTrigger trigger) { Machine.Fire(trigger); }