示例#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)
            {
                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);
        }
示例#2
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);
        }
示例#3
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();
                }
            }
        }
示例#4
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);
        }
示例#5
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);
        }
示例#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)
            {
                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);
        }
示例#7
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);
        }
        //-------------------------------------------------
        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);
        }