private void CmdStartHyperspaceJump(HyperspaceJump jump) { if (inProgressHyperspaceJump != null) { Debug.Log($"Hyperspace jump for {this} already in progress: {inProgressHyperspaceJump}"); return; } if (jump.fromSystem != gameObject.scene.name) { Debug.LogError($"Client requested hyperspace jump from system {jump.fromSystem}, but player is in {gameObject.scene.name}"); return; } inProgressHyperspaceJump = new InProgressHyperspaceJump(jump); TargetPrepareForHyperspaceJump(jump); // In host mode, the target scene should already be loaded. if (isLocalPlayer) { MoveToScene(SceneManager.GetSceneByName(jump.toSystem)); } else { connectionToClient.Send(new SceneMessage { sceneName = jump.toSystem, sceneOperation = SceneOperation.LoadAdditive, customHandling = true }); } }
private void FinishHyperspaceJumpIfReady() { if (!inProgressHyperspaceJump.clientPlayerReady || !inProgressHyperspaceJump.clientSceneLoaded) { return; } HyperspaceJump jump = inProgressHyperspaceJump.jump; Scene scene = SceneManager.GetSceneByName(jump.toSystem); Debug.Assert(scene.IsValid() && scene.isLoaded, $"Scene for hyperspace jump {jump} is invalid"); // This needs to be cleared before MoveToScene, because it calls back into this method otherwise. inProgressHyperspaceJump = null; MoveToScene(scene); TargetArriveFromHyperspaceJump(jump); }