Exemplo n.º 1
0
    void Update()
    {
        if (pointer == null)
        {
            return;
        }

        if (OVRInput.GetDown(OVRInput.Button.Any, OVRInput.Controller.RTrackedRemote) || OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.RTrackedRemote))
        {
            Ray          ray  = new Ray(pointer.StartPoint, pointer.Forward);
            RaycastHit[] hits = Physics.RaycastAll(ray, 100f);
            foreach (RaycastHit hit in hits)
            {
                //Debug.Log ($"Hit {hit.transform.name}");
                SelectionReactor reactor = GetReactorForHit(hit);
                if (reactor != null)
                {
                    //Debug.Log ("Perform action");
                    reactor.Select();
                    if (!reactor.propogateHit)
                    {
                        break;
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    private void OnBubbleSelected(SelectionReactor reactor)
    {
        Bubble  bubble  = reactor.GetComponent <Bubble> ();
        Texture texture = bubble.Texture;

        EventBus.Instance.Raise(new BubbleEvent(bubble.environmentIndex, reactor.userData));
        EventBus.Instance.AddListener <NavigationEvent> (OnNavEvent);
    }
Exemplo n.º 3
0
    void Awake()
    {
        _inside  = transform.Find("SphereInside").gameObject;
        _outside = transform.Find("SphereOutside").gameObject;
        Transform textDisplay = transform.Find("TextDisplay");

        _bg          = textDisplay.GetComponent <SpriteRenderer> ();
        _textDisplay = textDisplay.GetComponent <TextDisplay> ();
        _highlight   = transform.Find("Highlight").GetComponent <SpriteRenderer> ();
        _reactor     = GetComponent <SelectionReactor> ();

        SetHighlight(false, Color.white);
    }
Exemplo n.º 4
0
    private SelectionReactor GetReactorForHit(RaycastHit hit)
    {
        Transform tr = hit.transform;

        while (tr != null)
        {
            SelectionReactor reactor = tr.GetComponent <SelectionReactor> ();
            if (reactor != null && reactor.enabled)
            {
                return(reactor);
            }
            tr = tr.parent;
        }
        return(null);
    }
Exemplo n.º 5
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray          ray  = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit[] hits = Physics.RaycastAll(ray, 100f);
         foreach (RaycastHit hit in hits)
         {
             SelectionReactor reactor = GetReactorForHit(hit);
             if (reactor != null)
             {
                 reactor.Select();
                 if (!reactor.propogateHit)
                 {
                     break;
                 }
             }
         }
     }
 }