private void OnSelectExitInteractable(XRBaseInteractable _interactable)
        {
            if (!selectUse)
            {
                return;
            }

            XRLogger.Instance.LogInfo($"Select Exit : " + _interactable.name);

            // Interactable object is UI
            if (_interactable.gameObject.layer == 5)
            {
                XRUIManipulateProvider.InvokeUIManipulateEnd(_interactable.gameObject, baseInteractor);
            }

            selectedObject  = null;
            interactLength  = 0.0f;
            interactorPoint = Vector3.zero;
            isSelected      = false;

            XRInputManager.Instance.SetDeviceInteractingState(xrNode, false);
            XRInputManager.Instance.SetDeviceInteractObject(xrNode, null);
            XRInputManager.Instance.SetDeviceInteractLength(xrNode, 0.0f);
            XRInputManager.Instance.SetDeviceInteractOffet(xrNode, Vector3.zero, Vector3.zero);
        }
        private void Awake()
        {
            this.awakeTime       = Time.realtimeSinceStartup;
            this.networkIdentity = this.GetComponent <NetworkIdentity>();

            if (this.xrGrabInteractable == null)
            {
                this.xrGrabInteractable = this.GetComponent <XROffsetGrabbable>();
            }

            if (this.xrGrabInteractable == null)
            {
                this.xrGrabInteractable = this.GetComponent <XRGrabInteractable>();
            }

            if (this.xrGrabInteractable == null)
            {
                this.xrGrabInteractable = this.GetComponent <BetterXRGrabInteractable>();
            }

            if (!this.networkIdentity || !this.xrGrabInteractable)
            {
                Debug.LogError($"{this.name} has XRGrabHookup component, but invalid NetworkIdentity or XRGrabInteractable component(s).", this);
                return;
            }
            else if (this.networkIdentity.CanChangeOwner == false)
            {
                Debug.LogError($"{this.name} has XRGrabHookup component, but CanChangeOwner = false.", this);
            }

            this.xrGrabInteractable.selectEntered.AddListener(this.OnSelectEntered);
            this.xrGrabInteractable.selectExited.AddListener(this.OnSelectExited);
        }
        private void OnSelectEnterInteractable(XRBaseInteractable _interactable)
        {
            if (!selectUse || XRInputManager.Instance.GetDeviceInteractObject(xrNode) != null)
            {
                return;
            }

            XRLogger.Instance.LogInfo($"Select Enter : " + _interactable.name);

            // Interactable object is UI
            if (_interactable.gameObject.layer == 5)
            {
                XRUIManipulateProvider.InvokeUIManipulateStart(_interactable.gameObject, baseInteractor);
            }

            selectedObject  = baseInteractor.selectTarget.gameObject;
            interactLength  = Vector3.Distance(transform.position, currentInteractPoint);
            interactorPoint = transform.position;
            isSelected      = true;

            Ray ray = new Ray(transform.position, transform.forward * rayMaxLength);

            XRInputManager.Instance.SetDeviceInteractingState(xrNode, true);
            XRInputManager.Instance.SetDeviceInteractObject(xrNode, selectedObject);
            XRInputManager.Instance.SetDeviceInteractLength(xrNode, interactLength);
            XRInputManager.Instance.SetDeviceInteractOffet(xrNode, selectedObject.transform.position, ray.GetPoint(interactLength));
        }
Exemplo n.º 4
0
 private void StoreArrow(XRBaseInteractable interactable)
 {
     if (interactable is Arrow arrow)
     {
         currentArrow = arrow;
     }
 }
Exemplo n.º 5
0
    void Activated(XRBaseInteractable interactable)
    {
        DialToActivate.RotatingRigidbody = interactable.GetComponentInChildren <Rigidbody>();
        DialToActivate.gameObject.SetActive(true);

        interactable.interactionLayerMask = 0;
    }
Exemplo n.º 6
0
 private void OnTriggerEnter(Collider other)
 {
     if (triggerdInteractable == null)
     {
         triggerdInteractable = other.GetComponentInParent <XRBaseInteractable>();
     }
 }
Exemplo n.º 7
0
 private void TryApplyDefaultPose(XRBaseInteractable interactable)
 {
     if (interactable.TryGetComponent(out PoseContainer poseContainer))
     {
         ApplyDefaultPose();
     }
     _handAnimator.enabled = true;
 }
Exemplo n.º 8
0
 private void TryApplyObjectPose(XRBaseInteractable interactable)
 {
     _handAnimator.enabled = false;
     if (interactable.TryGetComponent(out PoseContainer poseContainer))
     {
         ApplyPose(poseContainer.pose);
     }
 }
Exemplo n.º 9
0
 void Awake()
 {
     audioSource      = GetComponent <AudioSource>();
     grabInteractable = GetComponent <XRBaseInteractable>();
     anim             = GetComponent <Animator>();
     recoil           = data.Recoil;
     originRecoil     = data.Recoil;
 }
Exemplo n.º 10
0
    private void Awake()
    {
        originalParent = transform.parent;
        interactable   = GetComponent <XRBaseInteractable>();

        interactable.onHoverEnter.AddListener(OnHoverEnter);
        interactable.onHoverExit.AddListener(OnHoverExit);
    }
Exemplo n.º 11
0
    private void SetOriginalScale(XRBaseInteractable interactable)
    {
        // This isn't necessary, but prevents an error when exiting play

        // Restore object to original scale

        // Reset just incase
    }
Exemplo n.º 12
0
    void Start()
    {
        colorSocket    = transform.parent.Find("ColorPlug").GetComponent <XRSocketInteractor>();
        emissionSocket = transform.parent.Find("EmissionPlug").GetComponent <XRSocketInteractor>();

        previousColor    = colorSocket.selectTarget;
        previousEmission = emissionSocket.selectTarget;
    }
Exemplo n.º 13
0
 void OnSocketEnter(XRBaseInteractable socketObject)
 {
     if (socketObject.gameObject.CompareTag(whichTag))
     {
         Debug.Log("OBJECT IS PLACED.");
         planeToActivate.SetActive(true);
     }
 }
 protected new void OnSelectEntering(XRBaseInteractable interactable)
 {
     OnSelectEntering(new SelectEnterEventArgs
     {
         interactable = interactable,
         interactor   = this
     });
 }
Exemplo n.º 15
0
    private void TweenSizeToSocket(XRBaseInteractable interactable)
    {
        // Find the new scale based on the size of the collider, and scale
        Vector3 targetScale = FindTargetScale();

        // Tween to our new scale
        Tween.LocalScale(interactable.transform, targetScale, sizingDuration, 0);
    }
 protected void OnSelectExit(XRBaseInteractable interactable)
 {
     OnSelectExiting(new SelectExitEventArgs
     {
         interactable = interactable,
         interactor   = this
     });
 }
Exemplo n.º 17
0
 private void TryApplyDefaultPose(XRBaseInteractable interactable)
 {
     // Try and get pose container, and apply
     if (interactable.TryGetComponent(out PoseContainer poseContainer))
     {
         ApplyDefaultPose();
     }
 }
Exemplo n.º 18
0
    private void Awake()
    {
        meshRenderer     = GetComponent <MeshRenderer>();
        originalMaterial = meshRenderer.material;

        interactable = GetComponent <XRBaseInteractable>();
        interactable.onHoverEntered.AddListener(SetSelectMaterial);
        interactable.onHoverExited.AddListener(SetOriginalMaterial);
    }
Exemplo n.º 19
0
 private void Start()
 {
     interactable = GetComponent <XRBaseInteractable>();
     if (isDeleteable)
     {
         StartCoroutine(DestroyTimer());
     }
     interactable.activated.AddListener(DeleteMagazine);
 }
Exemplo n.º 20
0
    private void Awake()
    {
        meshRenderer    = GetComponent <MeshRenderer>();
        hoverInteractor = GetComponent <XRBaseInteractable>();

        PlayMaterial = meshRenderer.material;

        hoverInteractor.onHoverEntered.AddListener(ChangeMaterial);
    }
Exemplo n.º 21
0
    private void OnTriggerExit(Collider other)
    {
        XRBaseInteractable newInteractable = other.GetComponentInParent <XRBaseInteractable>();

        if (newInteractable && newInteractable == triggerdInteractable)
        {
            triggerdInteractable = null;
        }
    }
Exemplo n.º 22
0
    protected override void OnSelectEnter(XRBaseInteractable interactable)
    {
        base.OnSelectEnter(interactable);

        if (Coin == null)
        {
            AddCoin(interactable.gameObject);
        }
    }
Exemplo n.º 23
0
 public void RemoveFilter(XRBaseInteractable interactable)
 {
     if (isOn && socketActive)
     {
         leakageParticles.Play(true);
         troubleAudio.volume = 1f;
         troubleAudio.Play();
     }
 }
Exemplo n.º 24
0
    public override bool CanSelect(XRBaseInteractable interactable)
    {
        // check hover for timing stuff - socket recycle time
        // prevents immediate regrabbing arrow
        // must be a base arrow interactable (or inherited) and must be held
        bool interactableArrow = interactable is ArrowInteractable && interactable.selectingInteractor != null;

        return(base.CanSelect(interactable) && CanHover(interactable) && interactableArrow && canGrabArrows);
    }
Exemplo n.º 25
0
    protected override void OnSelectExited(XRBaseInteractable interactable)
    {
        base.OnSelectExited(interactable);

        if (disableObj)
        {
            socketActive = false;
        }
    }
Exemplo n.º 26
0
    private void DisableHandColliders(XRBaseInteractable interactable)
    {
        var handColliders = transform.GetComponentInChildren <HandPresence>().GetComponentsInChildren <Collider>();

        foreach (var handCollider in handColliders)
        {
            handCollider.enabled = false;
        }
    }
Exemplo n.º 27
0
 public void RemoveBattery(XRBaseInteractable obj)
 {
     if (canSelectExit)
     {
         num_batteries--;
         batteryCount.SetText("" + num_batteries);
     }
     canDestroyBattery = true;
 }
Exemplo n.º 28
0
    public bool CheckForNewInteractable()
    {
        var newInteractable = GetInteractable();

        var isDifferent = IsDifferentInteractable(CurrentInteractable, newInteractable);

        CurrentInteractable = isDifferent ? newInteractable : CurrentInteractable;

        return(isDifferent);
    }
Exemplo n.º 29
0
 protected override void OnSelectEnter(XRBaseInteractable interactable)
 {
     base.OnSelectEnter(interactable);
     _inSocketScale = _inSocket.transform.localScale;
     if (_inSocket.tag != "Player")
     {
         AudioManager.Instance.PlaySFX(bagSlotFX);
     }
     _inSocket.transform.localScale = _inSocket.transform.localScale / 2;
 }
Exemplo n.º 30
0
    public override bool CanSelect(XRBaseInteractable interactable)
    {
        SocketTarget socketTarget = interactable.GetComponent <SocketTarget>();

        if (socketTarget == null)
        {
            return(false);
        }
        return(base.CanSelect(interactable) && (socketTarget.SocketType == AcceptedType) && ((isAttachedByOnlyGrab) ? (interactable as XRGrabableObject).CanSocketed() : true));
    }