public void SetObject() { XRBaseInteractable obj = transform.Find("AttachPoint").GetComponent <XRSocketInteractor>().selectTarget; raygunObject = obj.GetComponent <RaygunObject>(); raygunObjectType = raygunObject.raygunObjectType; }
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)); }
public override bool CanSelect(XRBaseInteractable interactable) { SocketTarget socketTarget = interactable.GetComponent <SocketTarget>(); if (socketTarget == null) { return(false); } return(base.CanSelect(interactable) && (socketTarget.SocketType == this.acceptedType)); }
public override bool CanSelect(XRBaseInteractable interactable) { var socketTarget = interactable.GetComponent <HavenSocketTarget>(); if (socketTarget == null) { return(false); } return(base.CanSelect(interactable) && socketTarget.CanSocket(this)); }
public void onXRHoverEnter(XRBaseInteractable interactable) { Component component = interactable.GetComponent <Component>(); if (component == null) { return; } component.setEnableSlotVisual(true); }
public override bool CanSelect(XRBaseInteractable interactable) { var mag = interactable?.GetComponent <Magazine>(); if (mag && canSelect) { return(base.CanSelect(interactable) && mag.magName == targetName); } else { return(false); } }
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); } } }
/// <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)); }
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; }
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); }
/// <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; }
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; }
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)); }
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; }); }
public void AddMagazine(XRBaseInteractable interactable) { magazine = interactable.GetComponent <Magazine>(); source.PlayOneShot(reload); hasSlide = false; }
public void AddMagazine(XRBaseInteractable interactable) { currentMagazine = interactable.GetComponent <Magazine>(); source.PlayOneShot(reload); }
private void GetMeshFilter(XRBaseInteractable interactable) { interactableMeshFilter = interactable.GetComponent <MeshFilter>(); }