예제 #1
0
        public override void LoadContent()
        {
            Instance = this;

            World.CreateComponentPool<BulletComponent>(200, 200);

            int depth = 1;
            World.SystemManager.SetSystem(new GridRendererSystem(), Artemis.Manager.GameLoopType.Draw, depth++);
            World.SystemManager.SetSystem(new BackgroundRendererSystem(), Artemis.Manager.GameLoopType.Draw, depth++);
            //World.SystemManager.SetSystem(new ShipRendererSystem(), Artemis.Manager.GameLoopType.Draw, depth++);
            World.SystemManager.SetSystem(new ParticleSystem(), Artemis.Manager.GameLoopType.Draw, depth++);
            World.SystemManager.SetSystem(new BoundingBoxRendererSystem(), Artemis.Manager.GameLoopType.Draw, depth++);
            World.SystemManager.SetSystem(new GenericDrawableRendererSystem(), Artemis.Manager.GameLoopType.Draw, depth++);
            World.SystemManager.SetSystem(new PhysicsDebugDrawSystem(), Artemis.Manager.GameLoopType.Draw, depth++);
            //World.SystemManager.SetSystem(new GuiSystem(), Artemis.Manager.GameLoopType.Draw, depth++);

            int priority = 1;
            World.SystemManager.SetSystem(new CameraControlSystem(), Artemis.Manager.GameLoopType.Update, priority++);
            World.SystemManager.SetSystem(new RigidBodySystem(), Artemis.Manager.GameLoopType.Update, priority++);
            //World.SystemManager.SetSystem(new MouseControlledTransformSystem(), Artemis.Manager.GameLoopType.Update, priority++);
            //World.SystemManager.SetSystem(new BoundingBoxSelectionSystem(), Artemis.Manager.GameLoopType.Update, priority++);

            World.SystemManager.SetSystem(new CoroutineSystem(), Artemis.Manager.GameLoopType.Update, priority++);
            //World.SystemManager.SetSystem(new PlayerShipControlSystem(), Artemis.Manager.GameLoopType.Update, priority++);
            World.SystemManager.SetSystem(new ShipUpdateSystem(), Artemis.Manager.GameLoopType.Update, priority++);
            //World.SystemManager.SetSystem(new StorySystem(), Artemis.Manager.GameLoopType.Update, priority++);
            World.SystemManager.SetSystem(new PhysicsSystem(), Artemis.Manager.GameLoopType.Update, priority++);

            _guiService = ServiceLocator.Instance.GetService<IGuiService>();
            InitializeDocument();
            _bgEntity = ServiceLocator.Instance.GetService<SpaceBackgroundGeneratorService>().GenerateBackground(World, GetHashCode());
            World.CreateCamera(Constants.ActiveCameraTag, ServiceLocator.Instance.GetService<GraphicsDevice>());

            World.InitializeAll();
        }
예제 #2
0
        protected override void LoadContent()
        {
            Content.RootDirectory = Path.GetFullPath(Settings.DataFolder);
            Environment.CurrentDirectory = Path.GetFullPath(Settings.DataFolder);
            FastSpriteBatch = new FastSpriteBatch(GraphicsDevice);

            Services.AddService(FastSpriteBatch);

            Services.AddService(Content);

            Timer = new TimerService();
            Services.AddService<ITimerService>(Timer);

            Coroutines = new CoroutineService();
            Services.AddService<ICoroutineService>(Coroutines);

            Services.AddService(GraphicsDevice);

            SpriteBatch = new SpriteBatch(GraphicsDevice);
            Services.AddService(SpriteBatch);

            Keyboard = new KeyboardService(Coroutines);
            Services.AddService<IKeyboardService>(Keyboard);

            Services.AddService(Window);

            Mouse = new MouseService(Coroutines);
            Services.AddService<IMouseService>(Mouse);

            Services.AddService<IAnimationService>(new AnimationService(Coroutines, Timer));

            Gui = new GuiService();
            Services.AddService<IGuiService>(Gui);

            SpriteManager = new SpriteManagerService(Content);
            Services.AddService<ISpriteManagerService>(SpriteManager);

            ShapeManager = new ShapeManagerService();
            Services.AddService<IShapeManagerService>(ShapeManager);

            Services.AddService(new SpaceBackgroundGeneratorService());

            GalaxyGenerator = new GalaxyGeneratorService();

            var testShips = new[] { "Ships/Jaeger.json", "Ships/Scimitar.json" }
                            .Select(s => Persistence.LoadFromFile<Game.Ships.Ship>(s))
                            .ToList();

            Game.Space.Star.LoadStellarClasses();

            Galaxy = GalaxyGenerator.CreateGalaxy();

            //ShipRefitScene = new ShipRefitScene(testShips);
            //ShipRefitScene.LoadContent();

            MainMenuScene = new MainMenuScene();
            MainMenuScene.LoadContent();

            SystemMapScene = new SystemMapScene(Galaxy.StarSystems[0]);
            SystemMapScene.LoadContent();

            //CurrentScene = MainMenuScene;
            //CurrentScene = SystemMapScene;
            MainGameScene = new MainGameScene();
            MainGameScene.LoadContent();

            CurrentScene = MainGameScene;

            CombatEntityFactory.LoadWeapons();
            CombatEntityFactory.LoadProjectiles();
            base.LoadContent();
        }