Exemplo n.º 1
0
        public override void Initialise()
        {
            AddSingleton(new IntroBackgroundScroll());
            AddSingleton(new IntroControls());
            UserInterfaceManager.AddSceneUI(this, new IntroScreenTemplate());

            MusicManager.Start("Menu");
        }
Exemplo n.º 2
0
        public override void Initialise()
        {
            var camera    = Create();
            var cameraPos = camera.Add(new Transform()
            {
                Rotation = Quaternion.CreateFromYawPitchRoll(0, 0, (float)(Math.PI)),
            });

            //CameraManager.ActiveCamera = camera.Add(new Camera(new PerspectiveCameraParameters()));
            CameraManager.ActiveCamera = camera.Add(new Camera(new OrthographicCameraParameters(40)));
            CameraManager.ActiveCamera.Recalculate();


            AddSingleton(new SpaceBackgroundScroll(cameraPos));

            AddSingleton(new FlightSpaces());

            var shipEnt = Create();

            shipEnt.Add(new Transform());
            var flightShip = shipEnt.AddShipBasics(_shipTopology);

            shipEnt.Add(new RocketControls());
            shipEnt.Add(new CombatControls());
            shipEnt.Add(new ShipVelocityLimiter());
            shipEnt.Add(new PlayerDeathDetector());

            camera.Add(new FlightCameraControl(shipEnt));

            var phaseEnt = Create();
            var phases   = _phaseFactories
                           .Select(x => Create().Add(x()))
                           .ToArray();
            var phaseManager = phaseEnt.Add(new PhaseManager(
                                                phases
                                                ));

            phaseEnt.Add(new PhaseTitleDisplay());

            var progressTracker = Create().Add(new ProgressTracker());

            UserInterfaceManager.AddSceneUI(this, new FlightScreenTemplate(GraphicsDevice, flightShip, progressTracker));
            UserInterfaceManager.AddSceneUI(this, new LevelTransitionTemplate(phaseManager, _planet, progressTracker));
        }
Exemplo n.º 3
0
        public override void Initialise()
        {
            var camera    = Create();
            var cameraPos = camera.Add(new Transform()
            {
                Rotation = Quaternion.CreateFromYawPitchRoll(0, 0, (float)(Math.PI)),
                Location = (Vector3.Backward) * 10
            });

            CameraManager.ActiveCamera = camera.Add(new Camera(new OrthographicCameraParameters(10)));
            //CameraManager.ActiveCamera = camera.Add(new Camera(new PerspectiveCameraParameters()));
            CameraManager.ActiveCamera.LookAt(Vector3.Zero);
            CameraManager.ActiveCamera.Recalculate();

            int i = 0;

            for (var planet = 1; planet <= 8; planet++)
            {
                if (planet == 0)
                {
                    continue;
                }
                var planetRendererEnt = Create();
                planetRendererEnt.Add(new Transform
                {
                    Location = new Vector3(1f * i - 4f, 0, 0)
                });
                planetRendererEnt.Add(new PlanetRenderer()
                {
                    Planet = (Planet)i
                });
                i++;
            }
            UserInterfaceManager.AddSceneUI(this, new MenuScreenTemplate(this, SceneManager, FadeTransition));

            MusicManager.Start("Menu");
        }
Exemplo n.º 4
0
        public override void Initialise()
        {
            UserInterfaceManager.AddSceneUI(this, new DeathScreenTemplate(SceneManager));

            MusicManager.Start("Menu");
        }
Exemplo n.º 5
0
        public override void Initialise()
        {
            UserInterfaceManager.AddSceneUI(this, new WinScreenTemplate(SceneManager, FadeTransition));

            MusicManager.Start("Victory");
        }
Exemplo n.º 6
0
        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");
        }