// Token: 0x060015F7 RID: 5623 RVA: 0x00077D58 File Offset: 0x00075F58 protected virtual void CheckStopTouching() { if (this.touchedObject != null) { VRTK_InteractableObject component = this.touchedObject.GetComponent <VRTK_InteractableObject>(); if (component != null && component.GetGrabbingObject() != base.gameObject) { this.StopTouching(this.touchedObject); } } }
protected virtual void CheckStopTouching() { if (touchedObject != null) { VRTK_InteractableObject touchedObjectScript = touchedObject.GetComponent <VRTK_InteractableObject>(); //If it's being grabbed by the current touching object then it hasn't stopped being touched. if (touchedObjectScript != null && touchedObjectScript.GetGrabbingObject() != gameObject) { StopTouching(touchedObject); } } }
public void StartDespawn(float delayDespawn, float respawnWaitTime) { ClearRespawnOrDespawnProgress(); if (myState == RespawnObjectState.Valid) { if (myself.IsGrabbed()) { myself.Ungrabbed(myself.GetGrabbingObject()); } myState = RespawnObjectState.Despawning; //Shrink myself out of existence //Display a POOF particle. DespawningCorout = StartCoroutine(Despawn(delayDespawn, respawnWaitTime)); } }
protected virtual void DoReleaseObject(object sender, ControllerInteractionEventArgs e) { /// XXX: Jesse Magic /// Ignore grip inputs from primary grabbing controller if (grabbedObject != null && grabbedObject.GetComponent <VRTK_InteractableObject>()) { VRTK_InteractableObject objectGrabbedScript = grabbedObject.GetComponent <VRTK_InteractableObject>(); if (sender.ToString().Substring(0, sender.ToString().IndexOf(" ")) == objectGrabbedScript.GetGrabbingObject().ToString().Substring(0, sender.ToString().IndexOf(" "))) { return; } } AttemptReleaseObject(); OnGrabButtonReleased(controllerEvents.SetControllerEvent(ref grabPressed, false)); }
void Update() { // calcul de la progression du fondu au noir float oldProgression = blackoutProgression; if (viewmasterObject.IsGrabbed()) { float distance = 999; foreach (Transform anchorPoint in viewmasterObjectAnchors) { distance = Mathf.Min(distance, Vector3.Distance(anchorPoint.position, Camera.main.transform.position)); } float range = maxDistance - minDistance; blackoutProgression = (distance - minDistance) / range; } else { blackoutProgression += Time.deltaTime; } blackoutProgression = Mathf.Clamp(blackoutProgression, 0, 1); Color matCol = blackoutMesh.material.color; matCol.a = 1 - blackoutProgression * .9f; blackoutMesh.material.color = matCol; renderCam.enabled = blackoutProgression <= 1; if (blackoutProgression < 1 && oldProgression >= 1) { // calcul de la position de l'image en fonction de la tête du joueur portraitOrientation.localPosition = renderCam.transform.localPosition + new Vector3(0, -.1f, 0); portraitOrientation.localRotation = Quaternion.Euler( portraitOrientation.localEulerAngles.x, renderCam.transform.localEulerAngles.y, portraitOrientation.localEulerAngles.z); // désactivation TP teleportHandler.enabled = false; } else if (blackoutProgression >= 1 && oldProgression < 1) { teleportHandler.enabled = true; } // calcul de la progression du fondu de l'image if (blackoutProgression <= 0) { canvasProgression += Time.deltaTime; } else { canvasProgression -= Time.deltaTime * 7; } canvasProgression = Mathf.Clamp(canvasProgression, 0, 1); portraitsGroup.alpha = canvasProgression; if (blackoutProgression <= 0) { float angleBetweenPictures = 30; if (currentClip != null) { angleBetweenPictures = 180f / currentClip.images.Length; } // float angleBetweenPictures = 30; // à n'utiliser que si l'autre n'est pas assez intuitif GameObject grabbingObj = viewmasterObject.GetGrabbingObject(); if (grabbingObj != null) { VRTK.VRTK_ControllerEvents eventCtrl = grabbingObj.GetComponent <VRTK.VRTK_ControllerEvents>(); lastControllerActions = grabbingObj.GetComponent <VRTK.VRTK_ControllerActions>(); if (eventCtrl != null) { // on est en train de visionner l'image, on récupère la manette en train de tenir le VM afin de récupérer les swipes sur le pavé tactile eventCtrl.axisFidelity = 5; bool wasPressing = pressingButton; pressingButton = eventCtrl.IsButtonPressed(VRTK.VRTK_ControllerEvents.ButtonAlias.Touchpad_Touch); if (pressingButton && !wasPressing) { lastRotation = eventCtrl.GetTouchpadAxisAngle(); } float trigger = eventCtrl.GetTriggerAxis(); if (trigger != 1) { ignoreTrigger = false; } if (trigger == 1 && !ignoreTrigger) { ignoreTrigger = true; autoMoveToNextPicture = true; StartCoroutine(TriggerHapticCoroutine()); } if (pressingButton && trigger == 0 && false) { float oldPortraitRotation = currentPortraitRotation; // en train de faire un swipe float currentPadRotation = eventCtrl.GetTouchpadAxisAngle(); if (lastRotation - currentPadRotation < 180 && lastRotation - currentPadRotation > -180) { currentPortraitRotation += (lastRotation - currentPadRotation) * rotateSensitivity; } if (lastControllerActions != null && ((int)(currentPadRotation) / 35) != ((int)(lastRotation) / 35)) { lastControllerActions.TriggerHapticPulse(.05f); } if (currentPortraitRotation > angleBetweenPictures / 2 && oldPortraitRotation < angleBetweenPictures / 2) { StartCoroutine(TriggerHapticCoroutine()); } if (currentPortraitRotation < -angleBetweenPictures / 2 && oldPortraitRotation > -angleBetweenPictures / 2) { StartCoroutine(TriggerHapticCoroutine()); } lastRotation = currentPadRotation; } } } if (!pressingButton || autoMoveToNextPicture) { if (autoMoveToNextPicture) { currentPortraitRotation += Time.deltaTime * (angleBetweenPictures + .01f - currentPortraitRotation) * 10; } else { // retour à l'image la plus proche if (currentPortraitRotation > angleBetweenPictures / 2) { currentPortraitRotation += Time.deltaTime * (angleBetweenPictures + .01f - currentPortraitRotation) * 10; } else if (currentPortraitRotation < -angleBetweenPictures / 2) { currentPortraitRotation += Time.deltaTime * -(angleBetweenPictures + .01f + currentPortraitRotation) * 10; } else { currentPortraitRotation -= Time.deltaTime * currentPortraitRotation * 10; } } } if (currentPortraitRotation > angleBetweenPictures) { currentPortraitRotation -= angleBetweenPictures; nextImage(); } if (currentPortraitRotation < -angleBetweenPictures) { currentPortraitRotation += angleBetweenPictures; previousImage(); } // rotation de l'image leftImageTransform.transform.localRotation = Quaternion.Euler(0, 0, currentPortraitRotation); rightImageTransform.transform.localRotation = Quaternion.Euler(0, 0, currentPortraitRotation); leftImageTransformNext.transform.localRotation = Quaternion.Euler(0, 0, currentPortraitRotation + angleBetweenPictures); leftImageTransformPrev.transform.localRotation = Quaternion.Euler(0, 0, currentPortraitRotation - angleBetweenPictures); rightImageTransformNext.transform.localRotation = Quaternion.Euler(0, 0, currentPortraitRotation + angleBetweenPictures); rightImageTransformPrev.transform.localRotation = Quaternion.Euler(0, 0, currentPortraitRotation - angleBetweenPictures); } else { // rotation du disque du grabbable, pas de la vue. GameObject grabbingObj = viewmasterObject.GetGrabbingObject(); if (grabbingObj != null) { VRTK.VRTK_ControllerEvents eventCtrl = grabbingObj.GetComponent <VRTK.VRTK_ControllerEvents>(); lastControllerActions = grabbingObj.GetComponent <VRTK.VRTK_ControllerActions>(); if (eventCtrl != null) { // on est en train de visionner l'image, on récupère la manette en train de tenir le VM afin de récupérer les swipes sur le pavé tactile eventCtrl.axisFidelity = 5; bool wasPressing = pressingButton; pressingButton = eventCtrl.IsButtonPressed(VRTK.VRTK_ControllerEvents.ButtonAlias.Touchpad_Touch); if (pressingButton && !wasPressing) { lastRotation = eventCtrl.GetTouchpadAxisAngle(); } if (pressingButton && false) { // en train de faire un swipe float currentPadRotation = eventCtrl.GetTouchpadAxisAngle(); if (lastRotation - currentPadRotation < 180 && lastRotation - currentPadRotation > -180) { currentClipRotation += (lastRotation - currentPadRotation) * rotateSensitivity; } if (lastControllerActions != null && ((int)(currentPadRotation) / 275) != ((int)(lastRotation) / 275)) { triggerAnimator.SetTrigger("Trigger"); } lastRotation = currentPadRotation; viewmasterGrabbableClipRotation.transform.localRotation = Quaternion.Euler(currentClipRotation, 0, 0); } } } } }
protected virtual void OnTriggerStay(Collider collider) { GameObject colliderInteractableObject = TriggerStart(collider); if (touchedObject == null || collider.transform.IsChildOf(touchedObject.transform)) { triggerIsColliding = true; } // XXX: Jesse Magic if (colliderInteractableObject != null && IsObjectInteractable(collider.gameObject) && collider.name == "SwapControllerZone") { VRTK_InteractableObject collidedObjectScript = colliderInteractableObject.GetComponent <VRTK_InteractableObject>(); if (collidedObjectScript != null && collidedObjectScript.IsGrabbed() && this.gameObject != collidedObjectScript.GetGrabbingObject()) { if (!collidedObjectScript.secondaryGrabActionScript.isSwappable) { collidedObjectScript.secondaryGrabActionScript.isSwappable = true; //Debug.Log("Swappin' that shit!"); if (collider.transform.Find("Preview")) { collider.transform.Find("Preview").gameObject.SetActive(true); } // Emit touch event of swap zone if (ControllerTouchSwapZone != null) { ControllerTouchSwapZone(this, collider.gameObject); } } } } if (touchedObject == null && colliderInteractableObject != null && IsObjectInteractable(collider.gameObject)) { touchedObject = colliderInteractableObject; VRTK_InteractableObject touchedObjectScript = touchedObject.GetComponent <VRTK_InteractableObject>(); //If this controller is not allowed to touch this interactable object then clean up touch and return before initiating a touch. if (touchedObjectScript != null && !touchedObjectScript.IsValidInteractableController(gameObject, touchedObjectScript.allowedTouchControllers)) { CleanupEndTouch(); return; } OnControllerStartTouchInteractableObject(SetControllerInteractEvent(touchedObject)); StoreTouchedObjectColliders(collider); ToggleControllerVisibility(false); touchedObjectScript.StartTouching(this); OnControllerTouchInteractableObject(SetControllerInteractEvent(touchedObject)); } }