コード例 #1
0
    public void SetObject()
    {
        XRBaseInteractable obj = transform.Find("AttachPoint").GetComponent <XRSocketInteractor>().selectTarget;

        raygunObject     = obj.GetComponent <RaygunObject>();
        raygunObjectType = raygunObject.raygunObjectType;
    }
コード例 #2
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));
    }
コード例 #3
0
    public override bool CanSelect(XRBaseInteractable interactable)
    {
        SocketTarget socketTarget = interactable.GetComponent <SocketTarget>();

        if (socketTarget == null)
        {
            return(false);
        }

        return(base.CanSelect(interactable) && (socketTarget.SocketType == this.acceptedType));
    }
コード例 #4
0
        public override bool CanSelect(XRBaseInteractable interactable)
        {
            var socketTarget = interactable.GetComponent <HavenSocketTarget>();

            if (socketTarget == null)
            {
                return(false);
            }

            return(base.CanSelect(interactable) && socketTarget.CanSocket(this));
        }
コード例 #5
0
    public void onXRHoverEnter(XRBaseInteractable interactable)
    {
        Component component = interactable.GetComponent <Component>();

        if (component == null)
        {
            return;
        }

        component.setEnableSlotVisual(true);
    }
コード例 #6
0
    public override bool CanSelect(XRBaseInteractable interactable)
    {
        var mag = interactable?.GetComponent <Magazine>();

        if (mag && canSelect)
        {
            return(base.CanSelect(interactable) && mag.magName == targetName);
        }
        else
        {
            return(false);
        }
    }
コード例 #7
0
        public override void GetValidTargets(List <XRBaseInteractable> validTargets)
        {
            base.GetValidTargets(validTargets);

            //Discard those elements that does not match the interaction type
            for (int i = validTargets.Count - 1; i >= 0; i--)
            {
                XRBaseInteractable t = validTargets[i];
                if (
                    //The Grab ray only interacts with XRGrabInteractables and XRSimpleInteractables
                    _interactionType == InteractorType.Grab && (!t.GetComponent <XRGrabInteractable>() && !t.GetComponent <XRSimpleInteractable>()) ||

                    //The Teleport ray only interacts with BaseTeleportationInteractables.
                    _interactionType == InteractorType.Teleport && !t.GetComponent <BaseTeleportationInteractable>() ||

                    //The UI ray only interacts with objects in the UILayer.
                    _interactionType == InteractorType.UI && t.gameObject.layer != LayerMask.NameToLayer("UI")
                    )
                {
                    validTargets.RemoveAt(i);
                }
            }
        }
コード例 #8
0
    /// <summary>
    /// <c>CanHover</c>
    ///
    /// pre: ensure XR settings are correctly setup within Scene to conduct VR game play.
    ///
    /// post: handels when a the player points a joystick ray cast at a prop, activates the description UI window
    ///
    /// </summary>
    /// <param name="interactable">the object that we are currently interacting within scene</param>
    /// <returns>True if we can hover over a object. False if not.</returns>
    public override bool CanHover(XRBaseInteractable interactable)
    {
        if (interactable.gameObject.tag.Equals("Prop") || interactable.gameObject.tag.Equals("gloveBox"))
        {
            interactable.GetComponent <PopUpMenuHandler>().showUI();

            prop = interactable.gameObject;

            interactable.lastHoverExited.AddListener(onLastHoverExited);
        }



        return(base.CanHover(interactable));
    }
コード例 #9
0
        private void SlotOut(XRBaseInteractable i)
        {
            if (!i)
            {
                return;
            }

            if (filterSocket.selectTarget)
            {
                filterSocket.selectTarget.colliders[0].enabled = true;
            }
            else
            {
                filterSocket.socketActive = true;
            }
            i.GetComponent <PanelWithScrews>().unlocked = true;
        }
コード例 #10
0
    public override bool CanSelect(XRBaseInteractable interactable)
    {
        SocketTargetObject socketTarget = interactable.GetComponent <SocketTargetObject>();

        if (socketTarget == null)
        {
            return(false);
        }

        XRGrabbableObject grabInteractable = (interactable as XRGrabbableObject);

        if (grabInteractable == null)
        {
            return(false);
        }

        return(base.CanSelect(interactable) && socketTarget.SocketType == CoinType && grabInteractable.CanSocketed() && interactable.isSelected == false && Coin == null);
    }
コード例 #11
0
        /// <summary>
        /// Cuando el jugador agarra el objeto, se restablece el transform del objeto.
        /// Desliga el ingrediente que sostiene el NPC en la mano
        /// </summary>
        /// <param name="arg0"></param>
        private void OnPlayerGrabObject(XRBaseInteractor arg0)
        {
            picked = true;

            //Desuscripción a escuchar eventos de agarrar el objeto
            interactable.onSelectEnter.RemoveListener(OnPlayerGrabObject);

            // El ingrediente ya no está atado a la mano del NPC
            interactable.transform.SetParent(NPC.GrabbedInteractable.Parent);

            //Rigidbody del objeto se restablece a sus propiedades anteriores
            Rigidbody rb = interactable.GetComponent <Rigidbody>();

            rb.isKinematic = NPC.GrabbedInteractable.IsKinematic;

            //Reset del objeto agarrado por NPC
            NPC.GrabbedInteractable.Interactable = null;
            NPC.GrabbedInteractable.Parent       = null;
            NPC.GrabbedInteractable.IsKinematic  = false;
        }
コード例 #12
0
    public void OnRightHandObjectGrab(XRBaseInteractable inInteractable)
    {
        if (inInteractable == null)
        {
            return;
        }
        activeRightHandPartHandler = inInteractable.GetComponent <ConveyorPartHandler>();
        if (activeRightHandPartHandler != null)
        {
            activeRightHandPartHandler.OnPickedUpByRightHand();

            activeRightHandPartHandler.HandleActiveHeldPartTypeChanged(activeLeftHandPartHandler, activeRightHandPartHandler);
        }
        if (activeLeftHandPartHandler != null)
        {
            activeLeftHandPartHandler.HandleActiveHeldPartTypeChanged(activeLeftHandPartHandler, activeRightHandPartHandler);
        }

        rightHandDirectInteractor.interactionLayerMask = justRightHandPartLayerMask;
    }
コード例 #13
0
    public override bool CanSelect(XRBaseInteractable interactable)
    {
        socketTarget = interactable.GetComponent <SocketTarget>();

        if (socketTarget == null)
        {
            return(false);
        }

        //Debug.Log(interactable.GetComponent<SocketTarget>().name);

        /*
         * var VW_CheckedWires = GameObject.Find("WiresChecked").GetComponent<VW_CheckedWires>();
         * var UI_TextSocket = typeof(VW_CheckedWires).GetField(interactable.gameObject.name);
         *
         * if (UI_TextSocket != null)
         *  UI_TextSocket.SetValue(VW_CheckedWires, interactable.gameObject.name);
         */

        return(base.CanSelect(interactable) && (socketTarget.SocketType == AcceptedType));
    }
コード例 #14
0
    private void Awake()
    {
        originalParent        = transform.parent;
        interactable          = gameObject.GetComponent <XRBaseInteractable>();
        interactableRigidbody = interactable.GetComponent <Rigidbody>();

        interactableRigidbody.isKinematic = !canPush;

        if (canPush)
        {
            interactable.onFirstHoverEnter.AddListener((XRBaseInteractor) => { isHover = true; });
            interactable.onLastHoverExit.AddListener((XRBaseInteractor) => { isHover = false; });
        }

        interactable.onSelectEnter.AddListener((XRBaseInteractor) => { isSelected = true; });
        interactable.onSelectExit.AddListener((XRBaseInteractor) =>
        {
            isSelected = false;
            interactableRigidbody.velocity = Vector3.zero;
        });
    }
コード例 #15
0
ファイル: SimpleShoot.cs プロジェクト: SEOKDONGYUN/VR_R-Point
 public void AddMagazine(XRBaseInteractable interactable)
 {
     magazine = interactable.GetComponent <Magazine>();
     source.PlayOneShot(reload);
     hasSlide = false;
 }
コード例 #16
0
 public void AddMagazine(XRBaseInteractable interactable)
 {
     currentMagazine = interactable.GetComponent <Magazine>();
     source.PlayOneShot(reload);
 }
コード例 #17
0
 private void GetMeshFilter(XRBaseInteractable interactable)
 {
     interactableMeshFilter = interactable.GetComponent <MeshFilter>();
 }