示例#1
0
        //-------------------------------------------------
        private void TryTeleportPlayer(Hand hand)
        {
            if (visible && !teleporting)
            {
                if (pointedAtTeleportMarker != null && pointedAtTeleportMarker.locked == false)
                {
                    //Pointing at an unlocked teleport marker
                    teleportingToMarker   = pointedAtTeleportMarker;
                    globalScaleOnTeleport = globalScaleOnTeleportToTower;

                    TeleportPoint teleportPoint = teleportingToMarker as TeleportPoint;

                    rhand.DetachObject(rhand.currentAttachedObject);
                    lhand.DetachObject(lhand.currentAttachedObject);
                    teleportPoint.activateRelevantWeapons(hand);

                    if (teleportPoint.facingDirection != null)
                    {
                        player.trackingOriginTransform.rotation = teleportPoint.facingDirection.rotation;
                    }


                    InitiateTeleportFade();

                    CancelTeleportHint();
                }
            }
        }
示例#2
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)
            {
                teleportPoint.OnClickEvent.Invoke();
                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;

                if (player.leftHand.currentAttachedObjectInfo.HasValue)
                {
                    player.leftHand.ResetAttachedTransform(player.leftHand.currentAttachedObjectInfo.Value);
                }
                if (player.rightHand.currentAttachedObjectInfo.HasValue)
                {
                    player.rightHand.ResetAttachedTransform(player.rightHand.currentAttachedObjectInfo.Value);
                }
            }
            else
            {
                teleportingToMarker.TeleportPlayer(pointedAtPosition);
            }

            Teleport.Player.Send(pointedAtTeleportMarker);
        }
示例#3
0
        // Token: 0x06002206 RID: 8710 RVA: 0x000A9058 File Offset: 0x000A7258
        private void TeleportPlayer()
        {
            this.teleporting = false;
            Teleport.PlayerPre.Send(this.pointedAtTeleportMarker);
            SteamVR_Fade.Start(Color.clear, this.currentFadeTime, false);
            TeleportPoint teleportPoint = this.teleportingToMarker as TeleportPoint;
            Vector3       a             = this.pointedAtPosition;

            if (teleportPoint != null)
            {
                a = teleportPoint.transform.position;
                if (teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene)
                {
                    teleportPoint.TeleportToScene();
                    return;
                }
            }
            RaycastHit raycastHit;

            if (this.teleportingToMarker as TeleportArea != null && this.floorFixupMaximumTraceDistance > 0f && Physics.Raycast(a + 0.05f * Vector3.down, Vector3.down, out raycastHit, this.floorFixupMaximumTraceDistance, this.floorFixupTraceLayerMask))
            {
                a = raycastHit.point;
            }
            if (this.teleportingToMarker.ShouldMovePlayer())
            {
                Vector3 b = this.player.trackingOriginTransform.position - this.player.feetPositionGuess;
                this.player.trackingOriginTransform.position = a + b;
            }
            else
            {
                this.teleportingToMarker.TeleportPlayer(this.pointedAtPosition);
            }
            Teleport.Player.Send(this.pointedAtTeleportMarker);
        }
        //-------------------------------------------------
        private void InitiateTeleportFade()
        {
            teleporting = true;

            //if (InteractionManager.Instance.moveType == InteractionManager.MovementType.TELEPORT)
            {
                currentFadeTime = teleportFadeTime;

                TeleportPoint teleportPoint = teleportingToMarker as TeleportPoint;
                if (teleportPoint != null && teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene)
                {
                    currentFadeTime *= 3.0f;
                    Teleport.ChangeScene.Send(currentFadeTime);
                }

                SteamVR_Fade.Start(Color.clear, 0);
                SteamVR_Fade.Start(Color.black, currentFadeTime);

                headAudioSource.transform.SetParent(player.hmdTransform);
                headAudioSource.transform.localPosition = Vector3.zero;
                PlayAudioClip(headAudioSource, teleportSound);

                Invoke("TeleportPlayer", currentFadeTime);
            }
            //else
            //{
            //    Invoke("TeleportPlayer", 0f);
            //}
        }
示例#5
0
        //-------------------------------------------------
        private void InitiateTeleportFade()
        {
            teleporting = true;

            currentFadeTime = teleportFadeTime;

            TeleportPoint teleportPoint = teleportingToMarker as TeleportPoint;

            if (teleportPoint != null && teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene)
            {
                currentFadeTime *= 3.0f;
                Teleport.ChangeScene.Send(currentFadeTime);
            }

            SteamVR_Fade.Start(Color.clear, 0);
            SteamVR_Fade.Start(Color.black, currentFadeTime);

            headAudioSource.transform.SetParent(player.hmdTransform);
            headAudioSource.transform.localPosition = Vector3.zero;
            PlayAudioClip(headAudioSource, teleportSound);

            if (teleportOnCooldown == false)            //кулдаун тп
            {
                Invoke("TeleportPlayer", currentFadeTime);
                teleportOnCooldown = true;
            }
        }
示例#6
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);
            }

            Teleport.Player.Send(pointedAtTeleportMarker);

            // Modified
            if (teleportPoint != null)
            {
                if (teleportPoint.setRoom == true)
                {
                    RoomProperties.instance.SetRoomLocation();
                }
            }
        }
示例#7
0
 //-------------------------------------------------
 void OnEnable()
 {
     if (Selection.activeTransform)
     {
         TeleportPoint teleportPoint = Selection.activeTransform.GetComponent <TeleportPoint>();
         teleportPoint.UpdateVisualsInEditor();
     }
 }
示例#8
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;
                teleportPointOpen.Highlight(false);

                HexCell dest = grid.GetCell(player.trackingOriginTransform.position);

                // Enlever les unités de déplacement à l'unité
                currentUnit.Speed    = currentUnit.Speed - dest.Distance;
                currentUnit.Location = dest;
            }
            else
            {
                teleportingToMarker.TeleportPlayer(pointedAtPosition);
            }

            Teleport.Player.Send(pointedAtTeleportMarker);
        }
示例#9
0
 public override void OnInspectorGUI()
 {
     DrawDefaultInspector();
     if (Selection.activeTransform)
     {
         TeleportPoint teleportPoint = Selection.activeTransform.GetComponent <TeleportPoint>();
         if (GUI.changed)
         {
             teleportPoint.UpdateVisualsInEditor();
         }
     }
 }
示例#10
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);
        }
示例#11
0
 //-------------------------------------------------
 private void CheckForSpawnPoint()
 {
     foreach (TeleportMarkerBase teleportMarker in teleportMarkers)
     {
         TeleportPoint teleportPoint = teleportMarker as TeleportPoint;
         if (teleportPoint && teleportPoint.playerSpawnPoint)
         {
             teleportingToMarker = teleportMarker;
             TeleportPlayer();
             break;
         }
     }
 }
示例#12
0
 void CheckForSpawnPoint()
 {
     for (int i = 0; i < teleportMarkers.Length; i++)
     {
         TeleportMarkerBase teleportMarker = teleportMarkers[i];
         TeleportPoint      teleportPoint  = teleportMarker as TeleportPoint;
         if (teleportPoint && teleportPoint.playerSpawnPoint)
         {
             StartCoroutine(TeleportPlayer(teleportPoint.transform.position, true, false, ""));
             break;
         }
     }
 }
示例#13
0
 // Token: 0x060021F9 RID: 8697 RVA: 0x000A7D3C File Offset: 0x000A5F3C
 private void CheckForSpawnPoint()
 {
     foreach (TeleportMarkerBase teleportMarkerBase in this.teleportMarkers)
     {
         TeleportPoint teleportPoint = teleportMarkerBase as TeleportPoint;
         if (teleportPoint && teleportPoint.playerSpawnPoint)
         {
             this.teleportingToMarker = teleportMarkerBase;
             this.TeleportPlayer();
             return;
         }
     }
 }
 private void CheckForSpawnPoint(Vector3 forceMoveSpawnPointToHere)
 {
     foreach (TeleportMarkerBase teleportMarker in teleportMarkers)
     {
         TeleportPoint teleportPoint = teleportMarker as TeleportPoint;
         if (teleportPoint && teleportPoint.playerSpawnPoint)
         {
             teleportPoint.transform.position = forceMoveSpawnPointToHere;
             teleportingToMarker = teleportMarker;
             TeleportPlayer();
             break;
         }
     }
 }
示例#15
0
        // Token: 0x06002205 RID: 8709 RVA: 0x000A8F84 File Offset: 0x000A7184
        private void InitiateTeleportFade()
        {
            this.teleporting     = true;
            this.currentFadeTime = this.teleportFadeTime;
            TeleportPoint teleportPoint = this.teleportingToMarker as TeleportPoint;

            if (teleportPoint != null && teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene)
            {
                this.currentFadeTime *= 3f;
                Teleport.ChangeScene.Send(this.currentFadeTime);
            }
            SteamVR_Fade.Start(Color.clear, 0f, false);
            SteamVR_Fade.Start(Color.black, this.currentFadeTime, false);
            this.headAudioSource.transform.SetParent(this.player.hmdTransform);
            this.headAudioSource.transform.localPosition = Vector3.zero;
            this.PlayAudioClip(this.headAudioSource, this.teleportSound);
            base.Invoke("TeleportPlayer", this.currentFadeTime);
        }
示例#16
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;

                RaycastHit hit;
                Physics.Linecast(player.hmdTransform.position, teleportPosition + playerFeetOffset, out hit, 1 << LayerMask.NameToLayer("Checkpoint"));

                if (hit.collider != null)
                {
                    hit.collider.GetComponent <TimedCheckpoint>().CompleteCheckpoint();
                    Debug.Log("Ran into " + hit.collider.name);
                }

                //if (InteractionManager.Instance.moveType == InteractionManager.MovementType.TELEPORT)
                player.trackingOriginTransform.position = teleportPosition + playerFeetOffset;//This is the line that changes the player's position. TODO

                if (Statistics.Instance.allowDataCollection)
                {
                    Statistics.Instance.data.teleportCount++;
                }
                //else
                //    dashTo = teleportPosition + playerFeetOffset;
            }

            /*else
             *          {
             *                  teleportingToMarker.TeleportPlayer( pointedAtPosition );
             *          }*/

            Teleport.Player.Send(pointedAtTeleportMarker);
        }
示例#17
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;

                if (teleportPoint.CompareTag("WirePoint"))
                {
                    isOnWirePoint = true;
                }

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

                hasAreaTeleported = true;
            }

            // 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;

                if (player.leftHand.currentAttachedObjectInfo.HasValue)
                {
                    player.leftHand.ResetAttachedTransform(player.leftHand.currentAttachedObjectInfo.Value);
                }

                if (player.rightHand.currentAttachedObjectInfo.HasValue)
                {
                    player.rightHand.ResetAttachedTransform(player.rightHand.currentAttachedObjectInfo.Value);
                }
            }
            else
            {
                teleportingToMarker.TeleportPlayer(pointedAtPosition);
            }

            Teleport.Player.Send(pointedAtTeleportMarker);

            timesTeleported++;

            bool[] spawnPortals = new bool[3];

            for (int i = 0; i < spawnPortals.Length; i++)
            {
                int randomNr = Random.Range(0, 100) + 1;
                //Debug.Log(randomNr);
                if (randomNr <= portalSpawnPercentageChance)
                {
                    spawnPortals[i] = true;
                }
            }
            PortalManager._instance.CheckSpawnPortal(spawnPortals);// CheckSpawnPortal(spawnPortals);
        }
示例#18
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)
            {
                Debug.Log("Was a teleport point");
                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;
            CubeType     cube         = null;

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


                    GameObject target = teleportArea.gameObject.transform.parent.gameObject;

                    Debug.Log("teleporting to teleport area: " + target.name);
                    cube = target.GetComponent <CubeType>();
                    Debug.Log("Did it have a float cube? " + cube);
                    foreach (Component obj in target.GetComponents(typeof(Component)))
                    {
                        Debug.Log("Component in " + target + ": " + obj);
                    }
                }
            }

            if (teleportingToMarker.ShouldMovePlayer())
            {
                Debug.Log("if ( teleportingToMarker.ShouldMovePlayer() )");
                Vector3 playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
                player.trackingOriginTransform.position = teleportPosition + playerFeetOffset;
                if (platform != null)
                {
                    if (platform.GetComponent <CubeType>() != null)
                    {
                        platform.GetComponent <CubeType>().Detach(GameObject.Find("Player"));
                    }
                    platform = null;
                }
                if (cube != null)
                {
                    Debug.Log("Raycast hit float cube");
                    cube.ApplyCollision(GameObject.Find("Player"));
                    platform = cube.gameObject;
                }

                if (player.leftHand.currentAttachedObjectInfo.HasValue)
                {
                    player.leftHand.ResetAttachedTransform(player.leftHand.currentAttachedObjectInfo.Value);
                }
                if (player.rightHand.currentAttachedObjectInfo.HasValue)
                {
                    player.rightHand.ResetAttachedTransform(player.rightHand.currentAttachedObjectInfo.Value);
                }
            }
            else
            {
                teleportingToMarker.TeleportPlayer(pointedAtPosition);
            }

            Teleport.Player.Send(pointedAtTeleportMarker);
        }