private Scene3D(Game game, Func <Viewport> getViewport, InputMessageBuffer inputMessageBuffer, int randomSeed, bool isDiagnosticScene, MapFile mapFile, string mapPath) { Game = game; PlayerManager = new PlayerManager(); Camera = new Camera(getViewport); SelectionGui = new SelectionGui(); DebugOverlay = new DebugOverlay(this, game.ContentManager); Random = new Random(randomSeed); if (mapFile != null) { 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); } RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer); if (!isDiagnosticScene) { RegisterInputHandler(new SelectionMessageHandler(game.Selection), inputMessageBuffer); RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer); RegisterInputHandler(_debugMessageHandler = new DebugMessageHandler(DebugOverlay), inputMessageBuffer); } ParticleSystemManager = AddDisposable(new ParticleSystemManager(game.AssetStore.LoadContext)); Radar = new Radar(this, game.AssetStore, mapPath); if (mapFile != null) { var borderWidth = mapFile.HeightMapData.BorderWidth * HeightMap.HorizontalScale; var width = mapFile.HeightMapData.Width * HeightMap.HorizontalScale; var height = mapFile.HeightMapData.Height * HeightMap.HorizontalScale; Quadtree = new Quadtree <GameObject>(new RectangleF(-borderWidth, -borderWidth, width, height)); } GameContext = new GameContext( game.AssetStore.LoadContext, game.Audio, ParticleSystemManager, new ObjectCreationListManager(), Terrain, Navigation, Radar, Quadtree, this); GameObjects = AddDisposable(new GameObjectCollection(GameContext)); GameContext.GameObjects = GameObjects; _orderGeneratorSystem = game.OrderGenerator; }
public Scene3D( Game game, InputMessageBuffer inputMessageBuffer, Func <Viewport> getViewport, ICameraController cameraController, MapFile mapFile, Terrain.Terrain terrain, Terrain.WaterArea[] waterAreas, Terrain.Road[] roads, Terrain.Bridge[] bridges, MapScriptCollection scripts, GameObjectCollection gameObjects, WaypointCollection waypoints, WaypointPathCollection waypointPaths, WorldLighting lighting, Player[] players, Team[] teams, bool isDiagnosticScene = false) { Camera = new Camera(getViewport); CameraController = cameraController; MapFile = mapFile; Terrain = terrain; WaterAreas = waterAreas; Roads = roads; Bridges = bridges; Scripts = scripts; GameObjects = AddDisposable(gameObjects); Waypoints = waypoints; WaypointPaths = waypointPaths; Lighting = lighting; SelectionGui = new SelectionGui(); RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer); DebugOverlay = new DebugOverlay(this, game.ContentManager); if (!isDiagnosticScene) { RegisterInputHandler(_selectionMessageHandler = new SelectionMessageHandler(game.Selection), inputMessageBuffer); RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer); RegisterInputHandler(_debugMessageHandler = new DebugMessageHandler(DebugOverlay), inputMessageBuffer); } _particleSystemManager = AddDisposable(new ParticleSystemManager(this)); _players = players.ToList(); _teams = teams.ToList(); // TODO: This is completely wrong. LocalPlayer = _players.FirstOrDefault(); }
public Scene3D( Game game, ICameraController cameraController, MapFile mapFile, Terrain.Terrain terrain, Terrain.WaterArea[] waterAreas, Terrain.Road[] roads, Terrain.Bridge[] bridges, MapScriptCollection scripts, GameObjectCollection gameObjects, WaypointCollection waypoints, WaypointPathCollection waypointPaths, WorldLighting lighting, Player[] players, Team[] teams) { Camera = new Camera(() => game.Viewport); CameraController = cameraController; MapFile = mapFile; Terrain = terrain; WaterAreas = waterAreas; Roads = roads; Bridges = bridges; Scripts = scripts; GameObjects = AddDisposable(gameObjects); Waypoints = waypoints; WaypointPaths = waypointPaths; Lighting = lighting; SelectionGui = new SelectionGui(); _selectionMessageHandler = new SelectionMessageHandler(game.Selection); game.InputMessageBuffer.Handlers.Add(_selectionMessageHandler); AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_selectionMessageHandler)); _cameraInputMessageHandler = new CameraInputMessageHandler(); game.InputMessageBuffer.Handlers.Add(_cameraInputMessageHandler); AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_cameraInputMessageHandler)); DebugOverlay = new DebugOverlay(this, game.ContentManager); _debugMessageHandler = new DebugMessageHandler(DebugOverlay); game.InputMessageBuffer.Handlers.Add(_debugMessageHandler); AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_debugMessageHandler)); _particleSystemManager = AddDisposable(new ParticleSystemManager(game, this)); _players = players.ToList(); _teams = teams.ToList(); // TODO: This is completely wrong. LocalPlayer = _players.FirstOrDefault(); }
private Scene3D(Game game, Func <Viewport> getViewport, InputMessageBuffer inputMessageBuffer, int randomSeed, bool isDiagnosticScene, MapFile mapFile) { Camera = new Camera(getViewport); SelectionGui = new SelectionGui(); DebugOverlay = new DebugOverlay(this, game.ContentManager); Random = new Random(randomSeed); if (mapFile != null) { 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); } RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer); if (!isDiagnosticScene) { RegisterInputHandler(new SelectionMessageHandler(game.Selection), inputMessageBuffer); RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer); RegisterInputHandler(_debugMessageHandler = new DebugMessageHandler(DebugOverlay), inputMessageBuffer); } _particleSystemManager = AddDisposable(new ParticleSystemManager(game.AssetStore.LoadContext)); GameContext = new GameContext( game.AssetStore.LoadContext, game.Audio, _particleSystemManager, new ObjectCreationListManager(), Terrain, Navigation); GameObjects = AddDisposable( new GameObjectCollection( GameContext, game.CivilianPlayer, Navigation)); GameContext.GameObjects = GameObjects; _orderGeneratorSystem = game.OrderGenerator; }
private Scene3D(Game game, Func <Viewport> getViewport, InputMessageBuffer inputMessageBuffer, bool isDiagnosticScene) { Camera = new Camera(getViewport); SelectionGui = new SelectionGui(); DebugOverlay = new DebugOverlay(this, game.ContentManager); RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer); if (!isDiagnosticScene) { RegisterInputHandler(_selectionMessageHandler = new SelectionMessageHandler(game.Selection), inputMessageBuffer); RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer); RegisterInputHandler(_debugMessageHandler = new DebugMessageHandler(DebugOverlay), inputMessageBuffer); } _particleSystemManager = AddDisposable(new ParticleSystemManager(this)); }
public Scene3D( Game game, ICameraController cameraController, MapFile mapFile, Terrain.Terrain terrain, MapScriptCollection scripts, GameObjectCollection gameObjects, WaypointCollection waypoints, WaypointPathCollection waypointPaths, WorldLighting lighting, Player[] players, Team[] teams) { Camera = new CameraComponent(game); CameraController = cameraController; MapFile = mapFile; Terrain = terrain; Scripts = scripts; GameObjects = AddDisposable(gameObjects); Waypoints = waypoints; WaypointPaths = waypointPaths; Lighting = lighting; SelectionGui = new SelectionGui(); _selectionMessageHandler = new SelectionMessageHandler(game.Selection); game.InputMessageBuffer.Handlers.Add(_selectionMessageHandler); AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_selectionMessageHandler)); _cameraInputMessageHandler = new CameraInputMessageHandler(); game.InputMessageBuffer.Handlers.Add(_cameraInputMessageHandler); AddDisposeAction(() => game.InputMessageBuffer.Handlers.Remove(_cameraInputMessageHandler)); _particleSystemManager = AddDisposable(new ParticleSystemManager(game, this)); _players = players.ToList(); _teams = teams.ToList(); // TODO: This is completely wrong. LocalPlayer = _players.FirstOrDefault(); }
private Scene3D(Game game, Func <Viewport> getViewport, InputMessageBuffer inputMessageBuffer, int randomSeed, bool isDiagnosticScene, MapFile mapFile, string mapPath) { Camera = new Camera(getViewport); SelectionGui = new SelectionGui(); DebugOverlay = new DebugOverlay(this, game.ContentManager); Random = new Random(randomSeed); if (mapFile != null) { 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); } if (mapPath != null) { var mapCache = game.AssetStore.MapCaches.GetByName(mapPath.ToLower()); if (mapCache == null) { mapCache = game.AssetStore.MapCaches.GetByName(Path.Combine(game.UserDataFolder, mapPath).ToLower()); } if (mapCache == null) { throw new Exception($"Failed to load MapCache \"{mapPath}\""); } MapCache = mapCache; } RegisterInputHandler(_cameraInputMessageHandler = new CameraInputMessageHandler(), inputMessageBuffer); if (!isDiagnosticScene) { RegisterInputHandler(new SelectionMessageHandler(game.Selection), inputMessageBuffer); RegisterInputHandler(_orderGeneratorInputHandler = new OrderGeneratorInputHandler(game.OrderGenerator), inputMessageBuffer); RegisterInputHandler(_debugMessageHandler = new DebugMessageHandler(DebugOverlay), inputMessageBuffer); } _particleSystemManager = AddDisposable(new ParticleSystemManager(game.AssetStore.LoadContext)); Radar = new Radar(this, game.AssetStore, MapCache); GameContext = new GameContext( game.AssetStore.LoadContext, game.Audio, _particleSystemManager, new ObjectCreationListManager(), Terrain, Navigation, Radar); GameObjects = AddDisposable( new GameObjectCollection( GameContext, game.CivilianPlayer, Navigation)); GameContext.GameObjects = GameObjects; _orderGeneratorSystem = game.OrderGenerator; }
// This is for drawing 2D elements which depend on the Scene3D, e.g tooltips and health bars. internal void Render(DrawingContext2D drawingContext) { SelectionGui.Draw(drawingContext, Camera); }