public void ResetShip() { if (_shipBody == null) { return; } // Reset ship position. if (_shipSpawnPoint == null) { DebugLog.ToConsole("_shipSpawnPoint is null!", MessageType.Warning); return; } _shipBody.SetVelocity(_shipSpawnPoint.GetPointVelocity()); _shipBody.WarpToPositionRotation(_shipSpawnPoint.transform.position, _shipSpawnPoint.transform.rotation); // Reset ship damage. if (Locator.GetShipTransform()) { foreach (var shipComponent in _shipComponents) { shipComponent.SetDamaged(false); } } Invoke(nameof(ExitShip), 0.01f); }
void GoToVessel() { var spawnPoint = GameObject.Find("Spawn_Vessel").GetComponent <SpawnPoint>(); OWRigidbody playerBody = Locator.GetPlayerBody(); playerBody.WarpToPositionRotation(spawnPoint.transform.position, spawnPoint.transform.rotation); playerBody.SetVelocity(spawnPoint.GetPointVelocity()); }
public void MoveTo(SpawnPoint point) { if (point != null) { OWRigidbody playerBody = Locator.GetPlayerBody(); playerBody.WarpToPositionRotation(point.transform.position, point.transform.rotation); playerBody.SetVelocity(point.GetPointVelocity()); point.AddObjectToTriggerVolumes(Locator.GetPlayerDetector().gameObject); point.OnSpawnPlayer(); } }
public void ResetPlayer() { // Reset player position. OWRigidbody playerBody = Locator.GetPlayerBody(); playerBody.WarpToPositionRotation(_playerSpawnPoint.transform.position, _playerSpawnPoint.transform.rotation); playerBody.SetVelocity(_playerSpawnPoint.GetPointVelocity()); _playerSpawnPoint.AddObjectToTriggerVolumes(Locator.GetPlayerDetector().gameObject); _playerSpawnPoint.AddObjectToTriggerVolumes(_fluidDetector.gameObject); _playerSpawnPoint.OnSpawnPlayer(); // Stop suffocation sound effect. _playerResources.SetValue("_isSuffocating", false); // Reset player health and resources. _playerResources.DebugRefillResources(); // Remove space suit. _spaceSuit.RemoveSuit(true); }
public void ResetShip() { if (_shipSpawnPoint == null) { DebugLog.ToConsole("Warning - _shipSpawnPoint is null!", MessageType.Warning); Init(); } if (_shipBody == null) { DebugLog.ToConsole($"Warning - Tried to reset ship, but the ship is null!", MessageType.Warning); return; } _shipBody.SetVelocity(_shipSpawnPoint.GetPointVelocity()); _shipBody.WarpToPositionRotation(_shipSpawnPoint.transform.position, _shipSpawnPoint.transform.rotation); foreach (var shipComponent in _shipComponents) { shipComponent.SetDamaged(false); } Invoke(nameof(ExitShip), 0.01f); }