Пример #1
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);
            Arial20               = Content.Load <SpriteFont>(@"Fonts\Arial20");
            wayPointsJSON         = (@"Content\JSONs\pathWaypoints.json");
            waveInfoJSON          = (@"Content\JSONs\waveInfo.json");
            playerProjectileSheet = Content.Load <Texture2D>(@"graphics\BlinkingCircle");
            enemyProjectileSheet  = Content.Load <Texture2D>(@"graphics\BlinkingCircle");
            playerSheet           = Content.Load <Texture2D>(@"graphics\BlinkingTriangle");
            enemySheet            = new Dictionary <int, Texture2D>();
            enemySheet[0]         = Content.Load <Texture2D>(@"graphics\EnemyArrow");
            enemySheet[1]         = Content.Load <Texture2D>(@"graphics\EnemyArrow2");
            enemySheet[2]         = Content.Load <Texture2D>(@"graphics\BossEnemy");
            titleScreen           = Content.Load <Texture2D>(@"graphics\TitleScreen");
            gameEndScreen         = Content.Load <Texture2D>(@"graphics\GameOverScreen");

            // Level design is currently hard coded inside the level class...use JSON in future to read in level design
            level = new LevelManager();
            level.readWaypointsJson(wayPointsJSON);
            level.readWaveInfoJson(waveInfoJSON);

            playerFactory = new PlayerFactory(
                playerSheet, playerProjectileSheet, new Rectangle(0, 0, 50, 50), 4,
                new Rectangle(0, 0, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));

            enemyFactory = new EnemyFactory(
                enemySheet, enemyProjectileSheet, new Rectangle(0, 0, 50, 50), 4,
                new Rectangle(0, 0, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height),
                level, playerFactory);

            collisionManager = new CollisionManager(playerFactory, enemyFactory);

            SoundManager.Initialize(Content);
        }
Пример #2
0
        // Constructor
        public EnemyFactory(Dictionary <int, Texture2D> graphics, Texture2D shotGraphic, Rectangle initialFrame,
                            int frameCount, Rectangle screenBounds, LevelManager level, PlayerFactory playerFactory)
        {
            this.graphics      = graphics;
            this.frameCount    = frameCount;
            this.playerFactory = playerFactory;
            this.curLevel      = level;

            EnemyShots = new ProjectileFactory(shotGraphic, new Rectangle(0, 0, 16, 16), 3, 2, 200f, screenBounds);
        }
Пример #3
0
 public CollisionManager(PlayerFactory playerFactory, EnemyFactory enemyFactory)
 {
     this.playerFactory = playerFactory;
     this.enemyFactory  = enemyFactory;
 }