protected override void OnSelectEntered(SelectEnterEventArgs args) { // Once select has occured, scale object to size var temp = args.interactable; if (temp is TwoHandGrabInteractable) { two = temp.GetComponent <TwoHandGrabInteractable>(); two.canTakeByOther = true; if (temp.GetComponentInChildren <XRSimpleInteractable>()) { simple = temp.GetComponentInChildren <XRSimpleInteractable>(); simple.enabled = false; } } else if (temp is XRItemGrabInteractable) { item = temp.GetComponent <XRItemGrabInteractable>(); if (item.GetComponent <DamageSystem>()) { ds = item.GetComponent <DamageSystem>(); ds.enabled = false; } item.canTakeByOther = true; } if (temp.GetComponentInChildren <XROffsetGrabInteractable>()) { offsetGrab = temp.GetComponentInChildren <XROffsetGrabInteractable>(); offsetGrab.enabled = false; } if (temp.GetComponentInChildren <XRSocketInteractorWithName>()) { socket = temp.GetComponentInChildren <XRSocketInteractorWithName>(); if (socket.selectTarget) { var mag = socket.selectTarget.GetComponent <Magazine>(); player.ammoCount += mag.ammoCount; player.SetText(mag.ammoCount, 1); Destroy(mag.gameObject); } socket.showInteractableHoverMeshes = false; socket.enabled = false; } base.OnSelectEntered(args); TweenSizeToSocket(temp); }
private void Start() { socketInteractor = GetComponent <XRSocketInteractorWithName>(); }
public override void OnInspectorGUI() { XRSocketInteractorWithName off = (XRSocketInteractorWithName)target; DrawDefaultInspector(); }