示例#1
0
        /// <summary>
        /// Render the gameplay screen.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime)
        {
            spriteBatch.DrawLine(HorizontalBoundaryStart, HorizontalBoundaryEnd, ColourHelpers.PureGreen, 2);

            if (!isGameover)
            {
                EnemyGroup.Draw(spriteBatch);
                UfoController.Draw(spriteBatch);
                ProjectileController.Draw(spriteBatch);
            }

            Player.Draw(spriteBatch);
            BarrierGroup.Draw(spriteBatch);

            DrawUI();
            DrawGameoverUI();
        }
示例#2
0
        /// <summary>
        /// Load the content for this gameplay screen.
        /// </summary>
        /// <param name="spriteBatch"></param>
        public override void LoadContent(SpriteBatch spriteBatch)
        {
            this.spriteBatch = spriteBatch;

            // Load fonts
            hudSpriteFont    = MainGame.Context.Content.Load <SpriteFont>("SpaceInvadersFont");
            headerSpriteFont = MainGame.Context.Content.Load <SpriteFont>("SpaceInvadersFontHeader");

            // Load all the enemy types
            EnemyType.Load(MainGame.Context.Content);

            Player       = new Player();
            BarrierGroup = new BarrierGroup();
            Player.InitializeHorizontalPosition();

            EnemyGroup           = new EnemyGroup();
            ProjectileController = new ProjectileController();
            UfoController        = new UfoController();
        }