// Token: 0x060016AC RID: 5804 RVA: 0x0007A6F8 File Offset: 0x000788F8 protected virtual void EmitControllerEvents(GameObject model, bool state) { GameObject gameObject = null; if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Left) { gameObject = VRTK_DeviceFinder.GetControllerLeftHand(false); } else if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Right) { gameObject = VRTK_DeviceFinder.GetControllerRightHand(false); } if (gameObject != null && gameObject.activeInHierarchy) { VRTK_ControllerEvents component = gameObject.GetComponent <VRTK_ControllerEvents>(); if (component != null) { if (state) { component.OnControllerVisible(component.SetControllerEvent()); return; } component.OnControllerHidden(component.SetControllerEvent()); } } }
protected virtual void OnEnable() { trackedObjects.Clear(); movementList.Clear(); previousYPositions.Clear(); initialGaze = Vector3.zero; currentDirection = Vector3.zero; previousDirection = Vector3.zero; averagePeriod = 60; currentSpeed = 0f; movementEngaged = false; previousEngageButton = engageButton; bodyPhysics = (bodyPhysics != null ? bodyPhysics : FindObjectOfType <VRTK_BodyPhysics>()); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed); SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed); headset = VRTK_DeviceFinder.HeadsetTransform(); SetControlOptions(controlOptions); playArea = VRTK_DeviceFinder.PlayAreaTransform(); // Initialize the lists. for (int i = 0; i < trackedObjects.Count; i++) { Transform trackedObj = trackedObjects[i]; VRTK_SharedMethods.AddDictionaryValue(movementList, trackedObj, new List <float>(), true); VRTK_SharedMethods.AddDictionaryValue(previousYPositions, trackedObj, trackedObj.transform.localPosition.y, true); } }
protected virtual void OnEnable() { VRTK_ObjectCache.registeredHeadsetControllerAwareness = this; headset = VRTK_DeviceFinder.HeadsetTransform(); leftController = VRTK_DeviceFinder.GetControllerLeftHand(); rightController = VRTK_DeviceFinder.GetControllerRightHand(); }
public void DecrementHealth() { VRTK_DeviceFinder.GetControllerLeftHand().GetComponent <VRTK_ControllerActions>().TriggerHapticPulse(3000, 0.3f, 0.001f); VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_ControllerActions>().TriggerHapticPulse(3000, 0.3f, 0.001f); var audioSource = gameObject.GetComponent <AudioSource> (); playerHealth -= damagePerHit; if (playerHealth < 1) { Die(); } else if (playerHealth < 7) { audioSource.clip = slowHeartbeat; audioSource.Play(); } else if (playerHealth <= 2) { audioSource.clip = fastHeartbeat; audioSource.Play(); } Debug.Log(playerHealth); }
protected virtual void InitListeners(bool state) { InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); InitTeleportListener(state); }
private bool ControllersStillOverPreviousFloor() { if (fallRestriction == FallingRestrictors.No_Restriction) { return(false); } var controllerDropThreshold = 0.05f; var rightController = VRTK_DeviceFinder.GetControllerRightHand(); var leftController = VRTK_DeviceFinder.GetControllerLeftHand(); var previousY = playArea.position.y; var rightCheck = (rightController.activeInHierarchy && Mathf.Abs(ControllerHeightCheck(rightController) - previousY) < controllerDropThreshold); var leftCheck = (leftController.activeInHierarchy && Mathf.Abs(ControllerHeightCheck(leftController) - previousY) < controllerDropThreshold); if (fallRestriction == FallingRestrictors.Left_Controller) { rightCheck = false; } if (fallRestriction == FallingRestrictors.Right_Controller) { leftCheck = false; } if (fallRestriction == FallingRestrictors.Both_Controllers) { return(rightCheck && leftCheck); } return(rightCheck || leftCheck); }
protected virtual bool ControllersStillOverPreviousFloor() { if (fallRestriction == FallingRestrictors.NoRestriction) { return(false); } float controllerDropThreshold = 0.05f; GameObject rightController = VRTK_DeviceFinder.GetControllerRightHand(); GameObject leftController = VRTK_DeviceFinder.GetControllerLeftHand(); float previousY = playArea.position.y; bool rightCheck = (rightController.activeInHierarchy && Mathf.Abs(ControllerHeightCheck(rightController) - previousY) < controllerDropThreshold); bool leftCheck = (leftController.activeInHierarchy && Mathf.Abs(ControllerHeightCheck(leftController) - previousY) < controllerDropThreshold); if (fallRestriction == FallingRestrictors.LeftController) { rightCheck = false; } if (fallRestriction == FallingRestrictors.RightController) { leftCheck = false; } if (fallRestriction == FallingRestrictors.BothControllers) { return(rightCheck && leftCheck); } return(rightCheck || leftCheck); }
// Token: 0x060017E0 RID: 6112 RVA: 0x0007F3A0 File Offset: 0x0007D5A0 protected virtual void OnEnable() { this.trackedObjects = new List <Transform>(); this.movementList = new Dictionary <Transform, List <float> >(); this.previousYPositions = new Dictionary <Transform, float>(); this.initalGaze = Vector3.zero; this.direction = Vector3.zero; this.previousDirection = Vector3.zero; this.averagePeriod = 60; this.currentSpeed = 0f; this.active = false; this.previousEngageButton = this.engageButton; this.bodyPhysics = ((this.bodyPhysics != null) ? this.bodyPhysics : base.GetComponentInChildren <VRTK_BodyPhysics>()); this.controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(false); this.controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(false); this.SetControllerListeners(this.controllerLeftHand, this.leftController, ref this.leftSubscribed, false); this.SetControllerListeners(this.controllerRightHand, this.rightController, ref this.rightSubscribed, false); this.headset = VRTK_DeviceFinder.HeadsetTransform(); this.SetControlOptions(this.controlOptions); this.playArea = VRTK_DeviceFinder.PlayAreaTransform(); for (int i = 0; i < this.trackedObjects.Count; i++) { Transform transform = this.trackedObjects[i]; this.movementList.Add(transform, new List <float>()); this.previousYPositions.Add(transform, transform.transform.localPosition.y); } if (this.playArea == null) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[] { "PlayArea", "Boundaries SDK" })); } }
//If the object is a controller, then emit the relevant event for it. protected virtual void EmitControllerEvents(GameObject model, bool state) { GameObject controllerObject = null; //Check to see if the given model is either the left or right controller model alias object if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Left) { controllerObject = VRTK_DeviceFinder.GetControllerLeftHand(false); } else if (VRTK_DeviceFinder.GetModelAliasControllerHand(model) == SDK_BaseController.ControllerHand.Right) { controllerObject = VRTK_DeviceFinder.GetControllerRightHand(false); } //if it is then attempt to get the controller events script from the script alias if (controllerObject != null && controllerObject.activeInHierarchy) { VRTK_ControllerEvents controllerEvents = controllerObject.GetComponent <VRTK_ControllerEvents>(); if (controllerEvents != null) { if (state) { controllerEvents.OnControllerVisible(controllerEvents.SetControllerEvent()); } else { controllerEvents.OnControllerHidden(controllerEvents.SetControllerEvent()); } } } }
protected virtual void TryPickup(bool rightHand) { Ray screenRay = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); RaycastHit hit; if (Physics.Raycast(screenRay, out hit)) { VRTK_InteractableObject io = hit.collider.gameObject.GetComponent <VRTK_InteractableObject>(); if (io != null) { GameObject hand; if (rightHand) { hand = VRTK_DeviceFinder.GetControllerRightHand(); } else { hand = VRTK_DeviceFinder.GetControllerLeftHand(); } VRTK_InteractGrab grab = hand.GetComponent <VRTK_InteractGrab>(); if (grab.GetGrabbedObject() == null) { hand.GetComponent <VRTK_InteractTouch>().ForceTouch(hit.collider.gameObject); grab.AttemptGrab(); } } } }
private void OnDisable() { DestroyCollider(); InitHeadsetListeners(false); InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), false); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), false); }
private void EnableBodyPhysics() { currentBodyCollisionsSetting = enableBodyCollisions; CreateCollider(); InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), true); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), true); }
private void Awake() { controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); headset = VRTK_DeviceFinder.HeadsetTransform(); SetControlOptions(controlOptions); }
private void InitListeners(bool state) { InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); InitTeleportListener(state); InitCollisionFadeListener(state); }
private void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); playArea = VRTK_DeviceFinder.PlayAreaTransform(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); }
// Token: 0x0600112A RID: 4394 RVA: 0x000647E0 File Offset: 0x000629E0 protected virtual void ManageDestinationMarkers(bool state) { this.ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerLeftHand(false), state); this.ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerRightHand(false), state); foreach (VRTK_DestinationMarker vrtk_DestinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { this.ManageDestinationMarkerListeners(vrtk_DestinationMarker.gameObject, state); } }
protected virtual void ManageDestinationMarkers(bool state) { ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); foreach (var destinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { ManageDestinationMarkerListeners(destinationMarker.gameObject, state); } }
private void OnEnable() { CreateCollider(); lastGoodPositionSet = false; headset = VRTK_DeviceFinder.HeadsetTransform(); StartCoroutine(WaitForHeadsetCollision(true)); InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), true); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), true); }
protected virtual void ManageDestinationMarkers(bool state) { ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); for (int i = 0; i < VRTK_ObjectCache.registeredDestinationMarkers.Count; i++) { VRTK_DestinationMarker destinationMarker = VRTK_ObjectCache.registeredDestinationMarkers[i]; ManageDestinationMarkerListeners(destinationMarker.gameObject, state); } }
// Token: 0x06001BAD RID: 7085 RVA: 0x00090CCD File Offset: 0x0008EECD public static SDK_BaseController.ControllerHand GetModelAliasControllerHand(GameObject givenObject) { if (VRTK_DeviceFinder.GetModelAliasController(VRTK_DeviceFinder.GetControllerLeftHand(false)) == givenObject) { return(SDK_BaseController.ControllerHand.Left); } if (VRTK_DeviceFinder.GetModelAliasController(VRTK_DeviceFinder.GetControllerRightHand(false)) == givenObject) { return(SDK_BaseController.ControllerHand.Right); } return(SDK_BaseController.ControllerHand.None); }
private void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); playArea = VRTK_DeviceFinder.PlayAreaTransform(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); if (!playArea) { Debug.LogError("No play area could be found. Have you selected a valid Boundaries SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Boundaries SDK from the dropdown."); } }
protected virtual void OnEnable() { playArea = VRTK_DeviceFinder.PlayAreaTransform(); headset = VRTK_DeviceFinder.HeadsetTransform(); controllingTransform = (controllingTransform != null ? controllingTransform : playArea); offsetTransform = (offsetTransform != null ? offsetTransform : headset); leftControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerLeftHand()); rightControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerRightHand()); movementActivated = false; rotationActivated = false; scaleActivated = false; ManageActivationListeners(true); }
protected virtual void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); playArea = VRTK_DeviceFinder.PlayAreaTransform(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); if (!playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); }
protected virtual void InitDestinationMarkerListeners(bool state) { var leftHand = VRTK_DeviceFinder.GetControllerLeftHand(); var rightHand = VRTK_DeviceFinder.GetControllerRightHand(); InitDestinationSetListener(leftHand, state); InitDestinationSetListener(rightHand, state); foreach (var destinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { if (destinationMarker.gameObject != leftHand && destinationMarker.gameObject != rightHand) { InitDestinationSetListener(destinationMarker.gameObject, state); } } }
// Token: 0x060017B3 RID: 6067 RVA: 0x0007EB70 File Offset: 0x0007CD70 protected virtual void InitDestinationMarkerListeners(bool state) { GameObject controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(false); GameObject controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(false); this.InitDestinationSetListener(controllerLeftHand, state); this.InitDestinationSetListener(controllerRightHand, state); foreach (VRTK_DestinationMarker vrtk_DestinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { if (vrtk_DestinationMarker.gameObject != controllerLeftHand && vrtk_DestinationMarker.gameObject != controllerRightHand) { this.InitDestinationSetListener(vrtk_DestinationMarker.gameObject, state); } } }
protected virtual void InitDestinationMarkerListeners(bool state) { GameObject leftHand = VRTK_DeviceFinder.GetControllerLeftHand(); GameObject rightHand = VRTK_DeviceFinder.GetControllerRightHand(); InitDestinationSetListener(leftHand, state); InitDestinationSetListener(rightHand, state); for (int i = 0; i < VRTK_ObjectCache.registeredDestinationMarkers.Count; i++) { VRTK_DestinationMarker destinationMarker = VRTK_ObjectCache.registeredDestinationMarkers[i]; if (destinationMarker.gameObject != leftHand && destinationMarker.gameObject != rightHand) { InitDestinationSetListener(destinationMarker.gameObject, state); } } }
// Token: 0x06001856 RID: 6230 RVA: 0x000812AC File Offset: 0x0007F4AC protected virtual void OnEnable() { this.touchpadAxisChanged = new ControllerInteractionEventHandler(this.DoTouchpadAxisChanged); this.touchpadUntouched = new ControllerInteractionEventHandler(this.DoTouchpadTouchEnd); this.controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(false); this.controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(false); this.playArea = VRTK_DeviceFinder.PlayAreaTransform(); if (!this.playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[] { "PlayArea", "Boundaries SDK" })); } this.headset = VRTK_DeviceFinder.HeadsetTransform(); if (!this.headset) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[] { "HeadsetTransform", "Headset SDK" })); } VRTK_PlayerObject.SetPlayerObject(base.gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); this.SetControllerListeners(this.controllerLeftHand, this.leftController, ref this.leftSubscribed, false); this.SetControllerListeners(this.controllerRightHand, this.rightController, ref this.rightSubscribed, false); this.bodyPhysics = base.GetComponent <VRTK_BodyPhysics>(); this.movementSpeed = 0f; this.strafeSpeed = 0f; this.blinkFadeInTime = 0f; this.lastWarp = 0f; this.lastFlip = 0f; this.lastSnapRotate = 0f; this.multiplyMovement = false; this.bodyCollider = this.playArea.GetComponentInChildren <CapsuleCollider>(); if (!this.bodyCollider) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[] { "VRTK_TouchpadMovement", "CapsuleCollider", "the PlayArea" })); } }
// Token: 0x06001BA2 RID: 7074 RVA: 0x00090B9B File Offset: 0x0008ED9B public static Transform DeviceTransform(VRTK_DeviceFinder.Devices device) { switch (device) { case VRTK_DeviceFinder.Devices.Headset: return(VRTK_DeviceFinder.HeadsetTransform()); case VRTK_DeviceFinder.Devices.LeftController: return(VRTK_DeviceFinder.GetControllerLeftHand(false).transform); case VRTK_DeviceFinder.Devices.RightController: return(VRTK_DeviceFinder.GetControllerRightHand(false).transform); default: return(null); } }
protected virtual Transform GetDirectionDevice() { switch (deviceForDirection) { case DirectionDevices.ControlledObject: return(controlledGameObject.transform); case DirectionDevices.Headset: return(VRTK_DeviceFinder.HeadsetTransform()); case DirectionDevices.LeftController: return(VRTK_DeviceFinder.GetControllerLeftHand(true).transform); case DirectionDevices.RightController: return(VRTK_DeviceFinder.GetControllerRightHand(true).transform); } return(null); }
protected virtual void OnEnable() { playArea = VRTK_DeviceFinder.PlayAreaTransform(); headset = VRTK_DeviceFinder.HeadsetTransform(); controllingTransform = (controllingTransform != null ? controllingTransform : playArea); offsetTransform = (offsetTransform != null ? offsetTransform : headset); leftControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerLeftHand()); rightControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerRightHand()); movementActivated = false; rotationActivated = false; scaleActivated = false; ManageActivationListeners(true); SetControllerReferences(); GameObject[] heavyObs = GameObject.FindGameObjectsWithTag("HeavyPickup"); heavies = new VRTK_InteractableObject[heavyObs.Length]; for (int i = 0; i < heavyObs.Length; i++) { heavies [i] = heavyObs [i].GetComponent(typeof(VRTK_InteractableObject)) as VRTK_InteractableObject; } }