Beispiel #1
0
    /// Called every frame the user is still looking at a valid GameObject. This
    /// can be a 3D or UI element.
    ///
    /// The camera is the event camera, the target is the object the user is
    /// looking at, and the intersectionPosition is the intersection point of the
    /// ray sent from the camera on the object.
    public void OnGazeStay(Camera camera, GameObject targetObject, Vector3 intersectionPosition,
                           bool isInteractive)
    {
        SetGazeTarget(intersectionPosition, isInteractive);
        if (targetObject.tag == "UIButton" && BluetoothReceiver.getInstance().GetBtn1Down())
        {
            if (targetObject.name == "Text" || targetObject.name == "Image")
            {
                targetObj = targetObject.transform.parent.gameObject;
            }
            else
            {
                targetObj = targetObject;
            }

            OnClick onClick = targetObj.GetComponent <OnClick> ();
            if (onClick != null)
            {
                onClick.OnClickFunc();
            }
            else
            {
                targetObj.GetComponent <Exitbutton> ().OnClickFunc();
            }
        }
    }