コード例 #1
0
        //-------------------------------------------------
        private void TeleportPlayer()
        {
            teleporting = false;

            Teleport.PlayerPre.Send(pointedAtTeleportMarker);

            SteamVR_Fade.Start(Color.clear, currentFadeTime);

            TeleportPoint teleportPoint    = teleportingToMarker as TeleportPoint;
            Vector3       teleportPosition = pointedAtPosition;

            if (teleportPoint != null)
            {
                teleportPosition = teleportPoint.transform.position;

                //Teleport to a new scene
                if (teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene)
                {
                    teleportPoint.TeleportToScene();
                    return;
                }
            }

            // Find the actual floor position below the navigation mesh
            TeleportArea teleportArea = teleportingToMarker as TeleportArea;

            if (teleportArea != null)
            {
                if (floorFixupMaximumTraceDistance > 0.0f)
                {
                    RaycastHit raycastHit;
                    if (Physics.Raycast(teleportPosition + 0.05f * Vector3.down, Vector3.down, out raycastHit, floorFixupMaximumTraceDistance, floorFixupTraceLayerMask))
                    {
                        teleportPosition = raycastHit.point;
                    }
                }
            }

            if (teleportingToMarker.ShouldMovePlayer())
            {
                Vector3 playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
                player.trackingOriginTransform.position = teleportPosition + playerFeetOffset;
            }
            else
            {
                teleportingToMarker.TeleportPlayer(pointedAtPosition);
            }

            //MJ20170525 Forcing disabling of highlight of future teleportPoint (necessary when never fully disabling teleport points, only mesh renderer)
            pointedAtTeleportMarker.Highlight(false);

            Teleport.Player.Send(pointedAtTeleportMarker);
        }
コード例 #2
0
        void HighlightSelected(TeleportMarkerBase new_marker)
        {
            if (current_teleport_marker != new_marker)               //Pointing at a new teleport marker
            {
                if (current_teleport_marker != null)
                {
                    current_teleport_marker.Highlight(false);
                }

                if (new_marker != null)
                {
                    new_marker.Highlight(true);
                    PlayPointerHaptic(!new_marker.locked);
                    reticleAudioSource.PlayClip(goodHighlightSound);
                }
                else if (current_teleport_marker != null)
                {
                    reticleAudioSource.PlayClip(badHighlightSound);
                }
            }
            else if (new_marker != null)               //Pointing at the same teleport marker
            {
                //trigger haptic based on time
            }
            current_teleport_marker = new_marker;
        }
コード例 #3
0
 // Token: 0x06002207 RID: 8711 RVA: 0x000A918C File Offset: 0x000A738C
 private void HighlightSelected(TeleportMarkerBase hitTeleportMarker)
 {
     if (this.pointedAtTeleportMarker != hitTeleportMarker)
     {
         if (this.pointedAtTeleportMarker != null)
         {
             this.pointedAtTeleportMarker.Highlight(false);
         }
         if (hitTeleportMarker != null)
         {
             hitTeleportMarker.Highlight(true);
             this.prevPointedAtPosition = this.pointedAtPosition;
             this.PlayPointerHaptic(!hitTeleportMarker.locked);
             this.PlayAudioClip(this.reticleAudioSource, this.goodHighlightSound);
             this.loopingAudioSource.volume = this.loopingAudioMaxVolume;
             return;
         }
         if (this.pointedAtTeleportMarker != null)
         {
             this.PlayAudioClip(this.reticleAudioSource, this.badHighlightSound);
             this.loopingAudioSource.volume = 0f;
             return;
         }
     }
     else if (hitTeleportMarker != null && Vector3.Distance(this.prevPointedAtPosition, this.pointedAtPosition) > 1f)
     {
         this.prevPointedAtPosition = this.pointedAtPosition;
         this.PlayPointerHaptic(!hitTeleportMarker.locked);
     }
 }
コード例 #4
0
        //-------------------------------------------------
        private void HighlightSelected(TeleportMarkerBase hitTeleportMarker)
        {
            if (pointedAtTeleportMarker != hitTeleportMarker)               //Pointing at a new teleport marker
            {
                if (pointedAtTeleportMarker != null)
                {
                    pointedAtTeleportMarker.Highlight(false);
                }

                if (hitTeleportMarker != null)
                {
                    hitTeleportMarker.Highlight(true);

                    prevPointedAtPosition = pointedAtPosition;
                    PlayPointerHaptic(!hitTeleportMarker.locked);

                    PlayAudioClip(reticleAudioSource, goodHighlightSound);

                    loopingAudioSource.volume = loopingAudioMaxVolume;
                }
                else if (pointedAtTeleportMarker != null)
                {
                    PlayAudioClip(reticleAudioSource, badHighlightSound);

                    loopingAudioSource.volume = 0.0f;
                }
            }
            else if (hitTeleportMarker != null)               //Pointing at the same teleport marker
            {
                if (Vector3.Distance(prevPointedAtPosition, pointedAtPosition) > 1.0f)
                {
                    prevPointedAtPosition = pointedAtPosition;
                    PlayPointerHaptic(!hitTeleportMarker.locked);
                }
            }
        }