internal Scene3D(Game game, MapFile mapFile, int randomSeed) : this(game, () => game.Viewport, game.InputMessageBuffer, randomSeed, false) { var contentManager = game.ContentManager; _players = Player.FromMapData(mapFile.SidesList.Players, game.AssetStore).ToList(); // TODO: This is completely wrong. LocalPlayer = _players.FirstOrDefault(); _teams = (mapFile.SidesList.Teams ?? mapFile.Teams.Items) .Select(team => Team.FromMapData(team, _players)) .ToList(); MapFile = mapFile; Terrain = AddDisposable(new Terrain.Terrain(mapFile, game.AssetStore.LoadContext)); WaterAreas = AddDisposable(new WaterAreaCollection(mapFile.PolygonTriggers, mapFile.StandingWaterAreas, mapFile.StandingWaveAreas, game.AssetStore.LoadContext)); Navigation = new Navigation.Navigation(mapFile.BlendTileData, Terrain.HeightMap); Audio = game.Audio; AssetLoadContext = game.AssetStore.LoadContext; Lighting = new WorldLighting( mapFile.GlobalLighting.LightingConfigurations.ToLightSettingsDictionary(), mapFile.GlobalLighting.Time); LoadObjects( game.AssetStore.LoadContext, game.CivilianPlayer, Terrain.HeightMap, mapFile.ObjectsList.Objects, MapFile.NamedCameras, _teams, out var waypoints, out var gameObjects, out var roads, out var bridges, out var cameras); Roads = roads; Bridges = bridges; GameObjects = gameObjects; Waypoints = waypoints; Cameras = cameras; PlayerScripts = mapFile .GetPlayerScriptsList() .ScriptLists .Select(s => new MapScriptCollection(s)) .ToArray(); CameraController = new RtsCameraController(game.AssetStore.GameData.Current) { TerrainPosition = Terrain.HeightMap.GetPosition( Terrain.HeightMap.Width / 2, Terrain.HeightMap.Height / 2) }; contentManager.GraphicsDevice.WaitForIdle(); }
internal Scene3D(Game game, MapFile mapFile) : this(game, () => game.Viewport, game.InputMessageBuffer, false) { var contentManager = game.ContentManager; _players = Player.FromMapData(mapFile.SidesList.Players, game.AssetStore).ToList(); // TODO: This is completely wrong. LocalPlayer = _players.FirstOrDefault(); _teams = (mapFile.SidesList.Teams ?? mapFile.Teams.Items) .Select(team => Team.FromMapData(team, _players)) .ToList(); MapFile = mapFile; Terrain = AddDisposable(new Terrain.Terrain(mapFile, game.AssetStore.LoadContext)); WaterAreas = AddDisposable(new WaterAreaCollection(mapFile.PolygonTriggers, mapFile.StandingWaterAreas, mapFile.StandingWaveAreas, game.AssetStore.LoadContext)); Lighting = new WorldLighting( mapFile.GlobalLighting.LightingConfigurations.ToLightSettingsDictionary(), mapFile.GlobalLighting.Time); LoadObjects( game.AssetStore.LoadContext, game.CivilianPlayer, Terrain.HeightMap, mapFile.ObjectsList.Objects, MapFile.NamedCameras, _teams, out var waypoints, out var gameObjects, out var roads, out var bridges, out var cameras); Roads = roads; Bridges = bridges; GameObjects = gameObjects; Waypoints = waypoints; WaypointPaths = new WaypointPathCollection(waypoints, mapFile.WaypointsList.WaypointPaths); Cameras = cameras; // TODO: Don't hardcode this. // Perhaps add one ScriptComponent for the neutral player, // and one for the active player. var scriptList = mapFile.GetPlayerScriptsList().ScriptLists[0]; Scripts = new MapScriptCollection(scriptList); CameraController = new RtsCameraController(game.AssetStore.GameData.Current) { TerrainPosition = Terrain.HeightMap.GetPosition( Terrain.HeightMap.Width / 2, Terrain.HeightMap.Height / 2) }; contentManager.GraphicsDevice.WaitForIdle(); }
internal Scene3D(Game game, MapFile mapFile, string mapPath, int randomSeed) : this(game, () => game.Viewport, game.InputMessageBuffer, randomSeed, false, mapFile, mapPath) { var contentManager = game.ContentManager; _players = Player.FromMapData(mapFile.SidesList.Players, game.AssetStore).ToList(); LocalPlayer = _players.First(); _teams = (mapFile.SidesList.Teams ?? mapFile.Teams.Items) .Select(team => Team.FromMapData(team, _players)) .ToList(); Audio = game.Audio; AssetLoadContext = game.AssetStore.LoadContext; Lighting = new WorldLighting( mapFile.GlobalLighting.LightingConfigurations.ToLightSettingsDictionary(), mapFile.GlobalLighting.Time); LoadObjects( game.AssetStore.LoadContext, Terrain.HeightMap, mapFile.ObjectsList.Objects, MapFile.NamedCameras, _teams, out var waypoints, out var roads, out var bridges, out var cameras); Roads = roads; Bridges = bridges; Waypoints = waypoints; Cameras = cameras; PlayerScripts = mapFile .GetPlayerScriptsList() .ScriptLists; CameraController = new RtsCameraController(game.AssetStore.GameData.Current, Camera, Terrain.HeightMap) { TerrainPosition = Terrain.HeightMap.GetPosition( Terrain.HeightMap.Width / 2, Terrain.HeightMap.Height / 2) }; contentManager.GraphicsDevice.WaitForIdle(); }