Exemple #1
0
        private void InitializeSystems(SpriteMapper spriteMapper)
        {
            // Prepare the systems
            SystemManager systemManager = new SystemManager(entityManager);

            systemManager.AddSystem(new RenderSystem(this, camera, spriteBatch, spriteMapper));
            systemManager.AddSystem(new InputSystem());
            GridSystem gridSystem = new GridSystem();

            entityGrid = gridSystem.EntityGrid;
            systemManager.AddSystem(gridSystem);
#if DEBUG
            systemManager.AddSystem(new CollisionSystem(GraphicsDevice, Content, camera));
#else
            systemManager.AddSystem(new CollisionSystem());
#endif
            systemManager.AddSystem(new PowerUpSystem(entityGrid));
            systemManager.AddSystem(new ExplosionSystem(entityGrid));
            systemManager.AddSystem(new BombSystem());
            systemManager.AddSystem(new MessageHandlerSystem());
            systemManager.AddSystem(new SoundSystem(Content));
            systemManager.AddSystem(new ScriptsSystem());
            systemManager.AddSystem(new FrameAnimationSystem(spriteMapper));
            systemManager.AddSystem(new GameStateSystem(this, entityGrid, spriteBatch, Content.Load <SpriteFont>("GUI")));
            systemManager.AddSystem(new PlayerSystem());
        }
Exemple #2
0
        private SpriteMapper InitializeSprites()
        {
            // Preload sprites
            SpriteMapper spriteMapper = new SpriteMapper();

            spriteMapper.AddTexture("Brick", Content.Load <Texture2D>(@"Textures\Brick"));
            spriteMapper.AddTexture("EndBrick", Content.Load <Texture2D>(@"Textures\EndBrick"));
            spriteMapper.AddTexture("SoftBrick", Content.Load <Texture2D>(@"Textures\SoftBrick"));
            spriteMapper.AddTexture("Man", Content.Load <Texture2D>(@"Textures\Man"));
            spriteMapper.AddTexture("Bomb", Content.Load <Texture2D>(@"Textures\Bomb"));
            spriteMapper.AddTexture("BombDangerous", Content.Load <Texture2D>(@"Textures\BombDangerous"));
            spriteMapper.AddTexture("BombSpiked", Content.Load <Texture2D>(@"Textures\BombSpiked"));
            spriteMapper.AddTexture("BombPower", Content.Load <Texture2D>(@"Textures\BombPower"));
            spriteMapper.AddTexture("BombRC", Content.Load <Texture2D>(@"Textures\BombRC"));
            spriteMapper.AddTexture("Explosion", Content.Load <Texture2D>(@"Textures\Explosion"), 8, 1);
            spriteMapper.AddTexture("ExplosionBlue", Content.Load <Texture2D>(@"Textures\ExplosionBlue"), 8, 1);
            spriteMapper.AddTexture("LandMine", Content.Load <Texture2D>(@"Textures\LandMine"), 4, 1);

            SpriteSheet ssPowerUps = new SpriteSheet(Content.Load <Texture2D>(@"Textures\PowerUps"), 4, 4);

            spriteMapper.AddTexture("PowerUp_BombUp", ssPowerUps, 0, 1, 0, 1);
            spriteMapper.AddTexture("PowerUp_BombDown", ssPowerUps, 1, 1, 3, 1);
            spriteMapper.AddTexture("PowerUp_FireUp", ssPowerUps, 1, 1, 0, 1);
            spriteMapper.AddTexture("PowerUp_FireDown", ssPowerUps, 2, 1, 3, 1);
            spriteMapper.AddTexture("PowerUp_SpeedUp", ssPowerUps, 2, 1, 0, 1);
            spriteMapper.AddTexture("PowerUp_SpeedDown", ssPowerUps, 3, 1, 3, 1);
            spriteMapper.AddTexture("PowerUp_FullFire", ssPowerUps, 3, 1, 0, 1);
            spriteMapper.AddTexture("PowerUp_PowerBomb", ssPowerUps, 0, 1, 2, 1);
            spriteMapper.AddTexture("PowerUp_DangerousBomb", ssPowerUps, 1, 1, 2, 1);
            spriteMapper.AddTexture("PowerUp_RemoteBomb", ssPowerUps, 3, 1, 2, 1);
            spriteMapper.AddTexture("PowerUp_PassThroughBomb", ssPowerUps, 2, 1, 2, 1);
            spriteMapper.AddTexture("PowerUp_LandMine", ssPowerUps, 0, 1, 3, 1);

            return(spriteMapper);
        }
Exemple #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            levelLoader = new LevelLoader(entityManager, Universe.TopLevelGroupUniqueIdBase);

            SpriteMapper spriteMapper = InitializeSprites();

            InitializeSystems(spriteMapper);

            needToLoadLevel = true;

            MediaPlayer.Play(Content.Load <Song>(@"Music\SpellRolemusic"));
            // Creative commons
            // Attribution:
            // <div xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/" about="http://freemusicarchive.org/music/Rolemusic/Straw_Fields/01_rolemusic_-_spell"><span property="dct:title">Spell</span> (<a rel="cc:attributionURL" property="cc:attributionName" href="http://freemusicarchive.org/music/Rolemusic/">Rolemusic</a>) / <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">CC BY-NC-SA 3.0</a></div>
            MediaPlayer.Volume      = 0.3f;
            MediaPlayer.IsRepeating = true;
        }