private IEnumerable <object> Loading() { SubmarineInfo subInfo = new SubmarineInfo(submarinePath); LevelGenerationParams generationParams = LevelGenerationParams.LevelParams.Find(p => p.Identifier.Equals(levelParams, StringComparison.OrdinalIgnoreCase)); yield return(CoroutineStatus.Running);
private IEnumerable <object> Loading() { SubmarineInfo subInfo = new SubmarineInfo(submarinePath); LevelGenerationParams generationParams = LevelGenerationParams.LevelParams.Find(p => p.Identifier.Equals(levelParams, StringComparison.OrdinalIgnoreCase)); yield return(CoroutineStatus.Running); GameMain.GameSession = new GameSession(subInfo, GameModePreset.Tutorial, missionPrefabs: null); (GameMain.GameSession.GameMode as TutorialMode).Tutorial = this; if (generationParams != null) { Biome biome = LevelGenerationParams.GetBiomes().FirstOrDefault(b => generationParams.AllowedBiomes.Contains(b)) ?? LevelGenerationParams.GetBiomes().First(); if (!string.IsNullOrEmpty(startOutpostPath)) { startOutpost = new SubmarineInfo(startOutpostPath); } if (!string.IsNullOrEmpty(endOutpostPath)) { endOutpost = new SubmarineInfo(endOutpostPath); } LevelData tutorialLevel = new LevelData(levelSeed, 0, 0, generationParams, biome); GameMain.GameSession.StartRound(tutorialLevel, startOutpost: startOutpost, endOutpost: endOutpost); } else { GameMain.GameSession.StartRound(levelSeed); } GameMain.GameSession.EventManager.ActiveEvents.Clear(); GameMain.GameSession.EventManager.Enabled = false; GameMain.GameScreen.Select(); yield return(CoroutineStatus.Success); }
private IEnumerable <object> Loading() { SubmarineInfo subInfo = new SubmarineInfo(submarinePath); LevelGenerationParams generationParams = LevelGenerationParams.LevelParams.Find(p => p.Name == levelParams); yield return(CoroutineStatus.Running); GameMain.GameSession = new GameSession(subInfo, "", GameModePreset.List.Find(g => g.Identifier == "tutorial")); (GameMain.GameSession.GameMode as TutorialMode).Tutorial = this; if (generationParams != null) { Biome biome = LevelGenerationParams.GetBiomes().Find(b => generationParams.AllowedBiomes.Contains(b)); if (startOutpostPath != string.Empty) { startOutpost = new SubmarineInfo(startOutpostPath); } if (endOutpostPath != string.Empty) { endOutpost = new SubmarineInfo(endOutpostPath); } Level tutorialLevel = new Level(levelSeed, 0, 0, generationParams, biome, startOutpost, endOutpost); GameMain.GameSession.StartRound(tutorialLevel); } else { GameMain.GameSession.StartRound(levelSeed); } GameMain.GameSession.EventManager.ActiveEvents.Clear(); GameMain.GameSession.EventManager.Enabled = false; GameMain.GameScreen.Select(); yield return(CoroutineStatus.Success); }
public RespawnManager(NetworkMember networkMember, SubmarineInfo shuttleInfo) : base(null) { this.networkMember = networkMember; if (shuttleInfo != null) { RespawnShuttle = new Submarine(shuttleInfo, true); RespawnShuttle.PhysicsBody.FarseerBody.OnCollision += OnShuttleCollision; //prevent wifi components from communicating between the respawn shuttle and other subs List <WifiComponent> wifiComponents = new List <WifiComponent>(); foreach (Item item in Item.ItemList) { if (item.Submarine == RespawnShuttle) { wifiComponents.AddRange(item.GetComponents <WifiComponent>()); } } foreach (WifiComponent wifiComponent in wifiComponents) { wifiComponent.TeamID = Character.TeamType.FriendlyNPC; } ResetShuttle(); shuttleDoors = new List <Door>(); foreach (Item item in Item.ItemList) { if (item.Submarine != RespawnShuttle) { continue; } var steering = item.GetComponent <Steering>(); if (steering != null) { shuttleSteering = steering; } var door = item.GetComponent <Door>(); if (door != null) { shuttleDoors.Add(door); } //lock all wires to prevent the players from messing up the electronics var connectionPanel = item.GetComponent <ConnectionPanel>(); if (connectionPanel != null) { foreach (Connection connection in connectionPanel.Connections) { foreach (Wire wire in connection.Wires) { if (wire != null) { wire.Locked = true; } } } } } } else { RespawnShuttle = null; } #if SERVER if (networkMember is GameServer server) { maxTransportTime = server.ServerSettings.MaxTransportTime; } #endif }