Example #1
0
    private void CallEvent()
    {
        var hit = CLOVRRaycast.Cast(new Vector2(Screen.width / 2.0f, Screen.height / 2.0f));

        if (hit.collider != null)
        {
            if (hit.collider.gameObject.tag == "EventTrigger")
            {
                // var targetObj = hit.collider.gameObject.transform;
                // var lighting = targetObj.Find("Selected").transform.GetComponent<Light>();
                // lighting.enabled = true;
                // eventObj.run();
            }
        }
    }
Example #2
0
 private void Pick()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         var hit = CLOVRRaycast.Cast(new Vector2(Screen.width / 2.0f, Screen.height / 2.0f));
         if (hit.collider != null)
         {
             //Debug.Log(hit.collider.gameObject.name);
             if (CanGrab(hit.collider.gameObject))
             {
                 if (Vector3.Distance(hit.collider.transform.position, cameraPivot.transform.position) < 4f)
                 {
                     hold       = true;
                     holdObject = hit.transform.gameObject;
                     holdObject.GetComponent <Rigidbody>().isKinematic = true;
                     holdObject.transform.SetParent(cameraPivot.transform);
                 }
             }
         }
     }
 }
Example #3
0
 private void TurnOnMachine()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         var hit = CLOVRRaycast.Cast(new Vector2(Screen.width / 2.0f, Screen.height / 2.0f));
         if (hit.collider != null)
         {
             Debug.Log(hit.collider.gameObject.name);
             if (hit.collider.gameObject.tag == "EventTrigger")
             {
                 // TODO play sound
                 socketEvent = hit.collider.gameObject.transform.Find("Machine").Find("Socket").GetComponent <SocketEventInterface>();
                 socketEvent.TurnOn();
             }
             else if (hit.collider.gameObject.tag == "UITrigger")
             {
                 uiEvent = hit.collider.gameObject.transform.Find("Event").GetComponent <UIEventInterface>();
                 uiEvent.Run();
             }
         }
     }
 }