//------------------------------------------------- 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); }
//------------------------------------------------- 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(); } } }
//------------------------------------------------- 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); }
//------------------------------------------------- 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); }
//------------------------------------------------- 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); }
//------------------------------------------------- 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); }