public override void Dispose() { base.Dispose(); EntityManager.Update(() => { _uiCleanup?.Invoke(); }); }
public override void Stop() { _camera.CameraScale = _oldCameraScale; _dispose?.Invoke(); }
public override void Initialise() { AddSingleton(new SpaceBackgroundScroll()); var focusLocation = HexagonHelpers.GetGridWorldPosition(new Point(2, 2)); var camera = Create(); var cameraPos = camera.Add(new Transform() { Rotation = Quaternion.CreateFromYawPitchRoll(0, 0, (float)(Math.PI)), Location = focusLocation + (Vector3.Backward + Vector3.Up * 1.8f) * 10 }); //CameraManager.ActiveCamera = camera.Add(new Camera(new OrthographicCameraParameters(10))); CameraManager.ActiveCamera = camera.Add(new Camera(new PerspectiveCameraParameters() { AspectRatio = GraphicsDevice.Viewport.AspectRatio })); CameraManager.ActiveCamera.LookAt(focusLocation); CameraManager.ActiveCamera.Recalculate(); camera.Add(new BuildCameraControl()); // Background planet. var planetEnt = Create(); planetEnt.Add(new Transform() { Location = cameraPos.Location + CameraManager.ActiveCamera.Forwards * 100 + Vector3.Forward * 50 }); var planetRenderer = planetEnt.Add(new PlanetRenderer() { AutoRender = true, Planet = _planet, Scale = 80f, RenderOrder = 20 }); var floor = Create(); floor.Add(new BuildFloor(_shipTopology)); var productionLine = AddSingleton(new ProductionLine()); var gameMode = AddSingleton(new BuildMode(_shipTopology, _planet)); var placerEnt = Create(); var placer = placerEnt.Add(new BuildPlacer(CameraManager.ActiveCamera, _shipTopology, productionLine)); placerEnt.Add(new BuildPlacerCursor()); var shipRenderer = AddSingleton(new ShipSectionRenderer()); UserInterfaceManager.AddSceneUI(this, new BuildScreenTemplate(gameMode, _planet, productionLine, placer, shipRenderer)); if (_planet == Planet.Earth) { UIDispose closeBeginScreen = null; closeBeginScreen = UserInterfaceManager.Create(new BeginScreenTemplate(() => { gameMode.Start(); EntityManager.Update(() => { closeBeginScreen?.Invoke(); }); })); } else { gameMode.Start(); } MusicManager.Start("Building"); }