void ProcessButtons(GameObject interactedObject, CAVE2.WandEvent playerInfo)
    {
        foreach (CAVE2.Button currentButton in CAVE2.Button.GetValues(typeof(CAVE2.Button)))
        {
            playerInfo.button = currentButton;

            // OnWandButtonDown
            if (CAVE2Manager.GetButtonDown(wandID, currentButton))
            {
                interactedObject.SendMessage("OnWandButtonDown", playerInfo, SendMessageOptions.DontRequireReceiver);
            }

            // OnWandButton
            else if (CAVE2Manager.GetButton(wandID, currentButton))
            {
                interactedObject.SendMessage("OnWandButton", playerInfo, SendMessageOptions.DontRequireReceiver);
            }

            // OnWandButtonUp
            if (CAVE2Manager.GetButtonUp(wandID, currentButton))
            {
                interactedObject.SendMessage("OnWandButtonUp", playerInfo, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Example #2
0
 new void OnWandButtonDown(CAVE2.WandEvent evt)
 {
     if (evt.button == clickButton)
     {
         my_click_Audio.Play();
     }
 }
    // Update is called once per frame
    void Update()
    {
        Vector3 raySource = transform.position;

        // Helper override to set wand pointer to mouse cursor
        if (CAVE2.Input.GetComponent <CAVE2AdvancedTrackingSimulator>().wandUsesHeadPosition)
        {
            raySource = transform.parent.position;
        }

        // Shoot a ray from the wand
        Ray        ray = new Ray(raySource, transform.TransformDirection(Vector3.forward));
        RaycastHit hit;

        // Get the first collider that was hit by the ray
        bool wandHit = Physics.Raycast(ray, out hit, 100, wandLayerMask);

        Debug.DrawLine(ray.origin, hit.point); // Draws a line in the editor

        if (wandHit)                           // The wand is pointed at a collider
        {
            CAVE2.WandEvent playerInfo = new CAVE2.WandEvent(playerID, wandID, CAVE2.Button.None, CAVE2.InteractionType.Pointing);

            // Send a message to the hit object telling it that the wand is hovering over it
            hit.collider.gameObject.SendMessage("OnWandPointing", playerInfo, SendMessageOptions.DontRequireReceiver);

            ProcessButtons(hit.collider.gameObject, playerInfo);
        }
    }
Example #4
0
 new void OnWandButtonDown(CAVE2.WandEvent evt)
 {
     if (evt.button == grabButton && (evt.interactionType == grabStyle || grabStyle == CAVE2.InteractionType.Any))
     {
         OnWandGrab(CAVE2.GetWandObject(evt.wandID).transform);
         grabbingWandID = evt.wandID;
     }
 }
Example #5
0
 new void OnWandButtonDown(CAVE2.WandEvent evt)
 {
     if (evt.button == clickButton)
     {
         //ani.SetTrigger("Active");
         ani.Play("jump-up", 0);
     }
 }
    public void OnWandButtonUp(CAVE2.WandEvent evt)
    {
        //CAVE2PlayerIdentity playerID = (CAVE2PlayerIdentity)evt[0];
        //int wandID = (int)evt[1];
        //CAVE2.Button button = (CAVE2.Button)evt[2];


        //Debug.Log("OnWandButtonUp: " + playerID.name + " " + wandID + " " + button);
    }
    void OnTriggerStay(Collider collider)
    {
        CAVE2.WandEvent playerInfo = new CAVE2.WandEvent(playerID, wandID, CAVE2.Button.None, CAVE2.InteractionType.Touching);

        // Send a message to the hit object telling it that the wand is hovering over it
        collider.gameObject.SendMessage("OnWandOver", playerInfo, SendMessageOptions.DontRequireReceiver);

        ProcessButtons(collider.gameObject, playerInfo);
    }
    new public void OnWandButtonDown(CAVE2.WandEvent evt)
    {
        CAVE2PlayerIdentity playerID = (CAVE2PlayerIdentity)evt.playerID;
        int wandID = (int)evt.wandID;

        CAVE2.Button button = (CAVE2.Button)evt.button;

        if (wandID == this.wandID && button == this.button)
        {
            CAVE2.LoadScene(sceneName);
        }
    }
Example #9
0
    void OnTriggerStay(Collider collider)
    {
        CAVE2.WandEvent playerInfo = new CAVE2.WandEvent(playerID, wandID, CAVE2.Button.None, CAVE2.InteractionType.Touching);

        // Send a message to the hit object telling it that the wand is hovering over it
        collider.gameObject.SendMessage("OnWandTouching", playerInfo, SendMessageOptions.DontRequireReceiver);

        if (collider.GetComponent <CAVE2Interactable>())
        {
            touchingObject = collider.gameObject;
            wandTouching   = true;
        }
    }
Example #10
0
 new void OnWandButtonDown(CAVE2.WandEvent evt)
 {
     if (evt.button == grabButton)
     {
         if (!grabbed && (evt.interactionType == grabStyle || grabStyle == CAVE2.InteractionType.Any))
         {
             grabber = CAVE2.GetWandObject(evt.wandID).transform;
             OnWandGrab();
             grabbingWandID = evt.wandID;
         }
         else if (grabbed && holdInteraction == HoldingStyle.ButtonPress)
         {
             OnWandGrabRelease();
         }
     }
 }
Example #11
0
 new void OnWandButtonDown(CAVE2.WandEvent evt)
 {
     if (evt.button == click_and_pause_Button && !hasStarted)
     {
         my_Audio.Play();
         isPlaying  = true;
         hasStarted = true;
     }
     else if (evt.button == click_and_pause_Button && isPlaying)
     {
         my_Audio.Pause();
         isPlaying = false;
         //hasStarted = false;
     }
     else if (evt.button == click_and_pause_Button && !isPlaying && hasStarted)
     {
         my_Audio.UnPause();
         isPlaying = true;
         //hasStarted = false;
     }
 }
Example #12
0
    public void OnWandButtonDown(CAVE2.WandEvent evt)
    {
        CAVE2PlayerIdentity playerID = evt.playerID;
        int wandID = evt.wandID;

        CAVE2.Button          button          = evt.button;
        CAVE2.InteractionType interactionType = evt.interactionType;


        Debug.Log("OnWandButtonDown: " + playerID.name + " " + wandID + " " + button);

        if (button == triggerButton && Vector3.Distance(player.transform.position, transform.position) < 10)
        {
            isOn = !isOn;

            UpdateItems();
        }


        //Debug.Log("OnWandButtonDown: ");
        //Debug.Log(evt);
    }
 public void OnWandPointing(CAVE2.WandEvent eventInfo)
 {
     OnWandPointingEvent();
 }
 public void OnWandOver(CAVE2.WandEvent eventInfo)
 {
     OnWandOverEvent();
 }
 public void OnWandTouching(CAVE2.WandEvent eventInfo)
 {
     OnWandTouchEvent();
 }
Example #16
0
 public new void OnWandButtonDown(CAVE2.WandEvent eventInfo)
 {
     parentObject.SendMessage("OnWandButtonDown", eventInfo, SendMessageOptions.DontRequireReceiver);
 }