Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            GameEntityFactory.GraphicsDevice = GraphicsDevice;

            frameCounterSystem = new FrameCounterSystem(true, this.Window);
            modelRenderSystem  = new ModelRenderSystem();
            modelRenderSystem.graphicsDevice = GraphicsDevice;
            playerInputSystem        = new PlayerInputSystem();
            cameraSystem             = new CameraSystem();
            uiSystem                 = new UIRenderSystem();
            collisionHandlingSystem  = new CollisionHandlingSystem();
            aiSystem                 = new AiSystem();
            collisionDetectionSystem = new CollisionDetectionSystem(false);
            frictionSystem           = new FrictionSystem();
            gravitySystem            = new GravitySystem();
            transformSystem          = new TransformSystem();


            SystemManager.Instance.AddToUpdateables(
                cameraSystem,
                collisionDetectionSystem,
                transformSystem,
                gravitySystem,
                frictionSystem,
                playerInputSystem,
                collisionHandlingSystem,
                aiSystem,
                frameCounterSystem
                );

            SystemManager.Instance.AddToDrawables(modelRenderSystem, frameCounterSystem, uiSystem);

            base.Initialize();
        }
Exemplo n.º 2
0
        public static GameContext GetWorldBoardContext(NamelessGame game)
        {
            if (WorldBoardContext != null)
            {
                return(WorldBoardContext);
            }
            else
            {
                var renderingSystem = new MapRenderingSystem(game.GetSettings(), game.WorldSettings);
                var systems         = new List <ISystem>();
                systems.Add(new InputSystem(new WorldMapKeyIntentTranslator(), game));
                systems.Add(new WorldBoardIntentSystem());
                systems.Add(new WorldBoardScreenSystem(renderingSystem));

                var uiSystem = new UIRenderSystem();

                // create and init the UI manager
                UiFactory.CreateWorldBoardScreen(game);
                WorldBoardContext = new GameContext(systems, new List <ISystem>()
                {
                    uiSystem, renderingSystem
                }, UiFactory.WorldBoardScreen);
                return(WorldBoardContext);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Where systems are added to the EntiyController.
 /// Currently you have to add them here manually
 /// </summary>
 private void InitSystems()
 {
     //generalSystems.Add(new PhysicsSystem(CIP,this));
     backGroundSystem   = new BackGroundSystem(graphicsDevice, this);
     chunkSystem        = new ChunkSystem(graphicsDevice, this, 100);
     playerSystem       = new PlayerSystem(this);
     cameraFollowSystem = new CameraFollowSystem(graphicsDevice, this);
     renderSystem       = new RenderSystem(new SpriteBatch(graphicsDevice), graphicsDevice, this);
     UIRenderSystem     = new UIRenderSystem(new SpriteBatch(graphicsDevice), this);
 }
Exemplo n.º 4
0
        public static GameContext GetMainMenuContext(NamelessGame game)
        {
            if (mainMenuContext != null)
            {
                return(mainMenuContext);
            }
            else
            {
                var systems = new List <ISystem>();
                systems.Add(new InputSystem(new MainMenuKeyIntentTranslator(), game));
                systems.Add(new MainMenuScreenSystem());
                var uiSystem = new UIRenderSystem();

                // create and init the UI manager
                UiFactory.CreateMainMenuScreen(game);
                mainMenuContext = new GameContext(systems, new List <ISystem>()
                {
                    uiSystem
                }, UiFactory.MainMenuScreen);
                return(mainMenuContext);
            }
        }
Exemplo n.º 5
0
        public static GameContext GetPickUpItemContext(NamelessGame game)
        {
            if (pickUpContext != null)
            {
                return(pickUpContext);
            }
            else
            {
                var systems = new List <ISystem>();
                systems.Add(new InputSystem(new PickUpKeyIntentTranslator(), game));
                systems.Add(new PickUpItemScreenSystem());
                systems.Add(new InventorySystem());
                var uiSystem = new UIRenderSystem();

                // create and init the UI manager
                UiFactory.CreatePickUpItemsScreenn(game);
                pickUpContext = new GameContext(systems, new List <ISystem>()
                {
                    uiSystem
                }, UiFactory.PickUpItemsScreen);
                return(pickUpContext);
            }
        }
Exemplo n.º 6
0
        public static GameContext GetIngameContext(NamelessGame game)
        {
            if (IngameContext != null)
            {
                return(IngameContext);
            }
            else
            {
                var systems = new List <ISystem>();
                systems.Add(new InputSystem(new IngameKeyIntentTraslator(), game));
                systems.Add(new IngameIntentSystem());
                systems.Add(new AiSystem());
                systems.Add(new TurnManagementSystem());
                systems.Add(new CombatSystem());
                systems.Add(new InventorySystem());
                systems.Add(new SwitchSystem());
                systems.Add(new DamageHandlingSystem());
                systems.Add(new DeathSystem());
                systems.Add(new HudSystem());
                systems.Add(new ChunkManagementSystem());

                var renderingSystem = new RenderingSystem(game.GetSettings());
                var uiSystem        = new UIRenderSystem();

                // create and init the UI manager
                UiFactory.CreateHud(game);

                IngameContext = new GameContext(systems, new List <ISystem>()
                {
                    uiSystem, renderingSystem
                },
                                                UiFactory.HudInstance);

                return(IngameContext);
            }
        }