Ejemplo n.º 1
0
 private bool NoArrowNotched(GameObject controller)
 {
     if (VRTK_DeviceFinder.IsControllerLeftHand(controller))
     {
         bow = VRTK_DeviceFinder.GetControllerRightHand(true).GetComponentInChildren <BowAim>();
     }
     else if (VRTK_DeviceFinder.IsControllerRightHand(controller))
     {
         bow = VRTK_DeviceFinder.GetControllerLeftHand(true).GetComponentInChildren <BowAim>();
     }
     return(bow == null || !bow.HasArrow());
 }
Ejemplo n.º 2
0
    void DoObjectGrab(object sender, InteractableObjectEventArgs e)
    {
        currentlyHeld = true;

        if (VRTK_DeviceFinder.IsControllerLeftHand(e.interactingObject))
        {
            controller = VRTK_DeviceFinder.GetControllerLeftHand().GetComponent <VRTK_InteractGrab>();
        }
        else
        {
            controller = VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_InteractGrab>();
        }
    }
Ejemplo n.º 3
0
 private void DoObjectGrab(object sender, InteractableObjectEventArgs e)
 {
     if (VRTK_DeviceFinder.IsControllerLeftHand(e.interactingObject))
     {
         holdControl   = VRTK_DeviceFinder.GetControllerLeftHand().GetComponent <VRTK_InteractGrab>();
         stringControl = VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_InteractGrab>();
     }
     else
     {
         stringControl = VRTK_DeviceFinder.GetControllerLeftHand().GetComponent <VRTK_InteractGrab>();
         holdControl   = VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_InteractGrab>();
     }
     StartCoroutine("GetBaseRotation");
 }
Ejemplo n.º 4
0
    private bool NoLightningAttached(GameObject controller)
    {
        if (VRTK_DeviceFinder.IsControllerLeftHand(controller))
        {
            GameObject controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(true);
            controllerRightHand.transform.Find("LightningBoltClone");
        }
        else if (VRTK_DeviceFinder.IsControllerRightHand(controller))
        {
            GameObject controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(true);
            controllerLeftHand.transform.Find("LightningBoltClone");
        }

        return(bow == null || !bow.HasArrow());
    }
Ejemplo n.º 5
0
    private void NormaliserUntouched(object sender, InteractableObjectEventArgs e)
    {
        if (VRTK_DeviceFinder.IsControllerLeftHand(e.interactingObject))
        {
            isLeftTouched = false;
        }
        else
        {
            isRightTouched = false;
        }

        if (!isLeftTouched && !isRightTouched)
        {
            transform.DOScale(initialScale, 0.35f);
        }
    }
Ejemplo n.º 6
0
    //public void OnEnter(WandController controller)
    //{
    //    OnEntered.Invoke();

    //    transform.localScale = rescaled;
    //}

    //public void OnExit(WandController controller)
    //{
    //    OnExited.Invoke();
    //    transform.localScale = initialScale;

    //}
    //public void OnDrag(WandController controller)
    //{
    //    float offset = parentAxis.CalculateLinearMapping(controller.transform);
    //    Vector3 newP = Vector3.Lerp(parentAxis.MinPosition, parentAxis.MaxPosition, offset);
    //    transform.position = newP;
    //}

    private void NormaliserTouched(object sender, InteractableObjectEventArgs e)
    {
        if (VRTK_DeviceFinder.IsControllerLeftHand(e.interactingObject))
        {
            isLeftTouched = true;
        }
        else
        {
            isRightTouched = true;
        }

        if (isLeftTouched ^ isRightTouched)
        {
            transform.DOScale(rescaled, 0.35f);
        }
    }
Ejemplo n.º 7
0
    private void OnTriggerEnter(Collider other)
    {
        if (!other.CompareTag("PlayerHand"))
        {
            return;
        }

        if (!isUseable)
        {
            return;
        }

        isLeftActive  = VRTK_DeviceFinder.IsControllerLeftHand(other.gameObject);
        isRightActive = VRTK_DeviceFinder.IsControllerRightHand(other.gameObject);

        //if (leftGrabControl.IsGrabButtonPressed())
        //{

        //}
    }
Ejemplo n.º 8
0
 // Token: 0x06001D4F RID: 7503 RVA: 0x00095FC0 File Offset: 0x000941C0
 protected virtual Transform GetSnapHandle(GameObject grabbingObject)
 {
     if (this.rightSnapHandle == null && this.leftSnapHandle != null)
     {
         this.rightSnapHandle = this.leftSnapHandle;
     }
     if (this.leftSnapHandle == null && this.rightSnapHandle != null)
     {
         this.leftSnapHandle = this.rightSnapHandle;
     }
     if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
     {
         return(this.rightSnapHandle);
     }
     if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
     {
         return(this.leftSnapHandle);
     }
     return(null);
 }
Ejemplo n.º 9
0
    public static void ForeGrabGesture(GameObject grabbingObject, GameObject grabbedObject)
    {
        string name = grabbedObject.name;

        if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
        {
            GameObject GrabPos = (GameObject)ObjPoolManager.Instance.Get("OculusGestures/Left/" + name + "L", false);
            if (GrabPos != null)
            {
                _ovrAvatar.LeftHandCustomPose = GrabPos.transform;
            }
        }
        else if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
        {
            GameObject GrabPos = (GameObject)ObjPoolManager.Instance.Get("OculusGestures/Right/" + name + "R", false);
            if (GrabPos != null)
            {
                _ovrAvatar.RightHandCustomPose = GrabPos.transform;
            }
        }
    }
Ejemplo n.º 10
0
        protected virtual Transform GetSnapHandle(GameObject grabbingObject)
        {
            if (rightSnapHandle == null && leftSnapHandle != null)
            {
                rightSnapHandle = leftSnapHandle;
            }

            if (leftSnapHandle == null && rightSnapHandle != null)
            {
                leftSnapHandle = rightSnapHandle;
            }

            if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
            {
                return(rightSnapHandle);
            }

            if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
            {
                return(leftSnapHandle);
            }

            // also check to see if it is a Hand

            if (grabbingObject.GetComponent <GestureControllerEvent>() != null)
            {
                if (grabbingObject.GetComponent <GestureControllerEvent>().controllerHandId == SDK_BaseGestureLibrary.Hand.Right)
                {
                    return(rightSnapHandle);
                }

                if (grabbingObject.GetComponent <GestureControllerEvent>().controllerHandId == SDK_BaseGestureLibrary.Hand.Left)
                {
                    return(leftSnapHandle);
                }
            }

            return(null);
        }
Ejemplo n.º 11
0
 // Token: 0x06001EC0 RID: 7872 RVA: 0x0009C248 File Offset: 0x0009A448
 private bool NoArrowNotched(GameObject controller)
 {
     if (VRTK_DeviceFinder.IsControllerLeftHand(controller))
     {
         GameObject controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(true);
         this.bow = controllerRightHand.GetComponentInChildren <BowAim>();
         if (this.bow == null)
         {
             this.bow = VRTK_DeviceFinder.GetModelAliasController(controllerRightHand).GetComponentInChildren <BowAim>();
         }
     }
     else if (VRTK_DeviceFinder.IsControllerRightHand(controller))
     {
         GameObject controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(true);
         this.bow = controllerLeftHand.GetComponentInChildren <BowAim>();
         if (this.bow == null)
         {
             this.bow = VRTK_DeviceFinder.GetModelAliasController(controllerLeftHand).GetComponentInChildren <BowAim>();
         }
     }
     return(this.bow == null || !this.bow.HasArrow());
 }
Ejemplo n.º 12
0
        private Transform GetSnapHandle(GameObject grabbingObject)
        {
            if (rightSnapHandle == null && leftSnapHandle != null)
            {
                rightSnapHandle = leftSnapHandle;
            }

            if (leftSnapHandle == null && rightSnapHandle != null)
            {
                leftSnapHandle = rightSnapHandle;
            }

            if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
            {
                return(rightSnapHandle);
            }

            if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
            {
                return(leftSnapHandle);
            }

            return(null);
        }
Ejemplo n.º 13
0
    private void InstantiatePhotonObjects(Scene arg0, LoadSceneMode arg1)
    {
        if (arg0.name == "MainScene")
        {
            // Instantiate spin menu
            GameObject spinMenu = PhotonNetwork.Instantiate("SpinMenu", Vector3.zero, Quaternion.identity, 0);
            spinMenu.GetComponent <SpinMenu>().SpinMenuToolChanged.AddListener(InteractionToolChanged);

            // Put spin menu on other controller
            spinMenu.transform.SetParent(VRTK_DeviceFinder.IsControllerLeftHand(gameObject) ? VRTK_DeviceFinder.GetControllerRightHand().transform.parent : VRTK_DeviceFinder.GetControllerLeftHand().transform.parent);
            spinMenu.transform.localPosition = Vector3.zero;
            spinMenu.transform.localRotation = Quaternion.identity;

            // Instantiate sprite renderer
            GameObject spriteRenderer = PhotonNetwork.Instantiate("InteractionModeSprite", Vector3.zero, Quaternion.identity, 0);
            selectedInteractionRenderer = spriteRenderer.GetComponent <NetworkedSprite>();
            spriteRenderer.transform.SetParent(transform);
            spriteRenderer.transform.localPosition = Vector3.up * 0.06f;
            spriteRenderer.transform.localRotation = Quaternion.identity;

            // Instantiate ranged brush
            rangedBrush = (GameObject)Instantiate(Resources.Load("BrushSphere"));
            rangedBrush.SetActive(false);

            // Create brushing and linking object
            GameObject bal = PhotonNetwork.Instantiate("BrushingAndLinking", Vector3.zero, Quaternion.identity, 0);
            brushingAndLinking = bal.GetComponent <BrushingAndLinking>();
            brushingInput1     = brushingAndLinking.input1;
            brushingInput2     = brushingAndLinking.input2;
            brushingAndLinking.NearestDistancesComputed.AddListener(DetailsOnDemandUpdated);

            // Instantiate networked tracer
            GameObject tracer = PhotonNetwork.Instantiate("NetworkedTracer", Vector3.zero, Quaternion.identity, 0);
            networkedTracer = tracer.GetComponent <NetworkedTrackedObject>();
            networkedTracer.SetTrackedObject(actualTracer);
            networkedTracer.SetColor(PlayerPreferencesManager.Instance.SharedBrushColor);
            // Hide the mesh for the owner (this does not get propagated)
            networkedTracer.GetComponent <Renderer>().enabled = false;

            // Instantiate networked brush
            GameObject brush = PhotonNetwork.Instantiate("NetworkedBrush", Vector3.zero, Quaternion.identity, 0);
            networkedBrush = brush.GetComponent <NetworkedTrackedObject>();
            networkedBrush.SetTrackedObject(rangedBrush);
            networkedBrush.SetColor(PlayerPreferencesManager.Instance.SharedBrushColor);
            // Hide the mesh for the owner (this does not get propagated)
            networkedBrush.GetComponent <Renderer>().enabled = false;

            // Instantiate label for details on demand
            GameObject dodlbl = PhotonNetwork.Instantiate("NetworkedDetailsOnDemandLabel", Vector3.zero, Quaternion.identity, 0);
            networkedDetailsOnDemandLabel = dodlbl.GetComponent <NetworkedDetailsOnDemandLabel>();
            networkedDetailsOnDemandLabel.ToggleState(false);

            // Instantiate 3D stick
            GameObject stick = PhotonNetwork.Instantiate("Stick3D", Vector3.zero, Quaternion.identity, 0);
            stick.transform.SetParent(transform);
            stick.transform.localPosition    = new Vector3(0.0105f, -0.0046f, 0.0784f);
            stick.transform.localEulerAngles = new Vector3(91.948f, 28.175f, 30.463f);
            pointerCustomisation             = stick.GetComponent <PointerCustomisation>();
            stickSphere = pointerCustomisation.stickSphere;
            pointerCustomisation.Disable3DStick();
        }
    }