示例#1
0
        public SpaceInvaders(ContentManager content)
        {
            m_blocksHeight  = 30.0;
            m_content       = content;
            m_castleTexture = m_content.Load <Texture2D>("Castle");
            m_blockTexture  = m_content.Load <Texture2D>("Block");

            m_gameRenderer   = new GameRenderer(SCREEN_WIDTH, SCREEN_HEIGHT);
            m_pendingObjects = new Queue <GameObject>();

            m_physics = new Physics();

            m_gameObjects = new List <GameObject>();

            m_aliensAlivePerLayer = new int[ALIEN_ROWS];

            ReadAliensBehaviour();

            Instantiate(new Player(content, new SPoint(50.0, 10.0), this));
            for (int i = 0; i < ALIEN_ROWS; i++)
            {
                CreateAlienRow(SCREEN_HEIGHT - ((i + 1) * DISTANCE_BETWEEN_ROWS), i);
            }

            m_aliensGoingRight = true;

            m_random = new Random();

            CreateCastle(new SPoint(20.0, m_blocksHeight));
            CreateCastle(new SPoint(40.0, m_blocksHeight));
            CreateCastle(new SPoint(60.0, m_blocksHeight));
            CreateCastle(new SPoint(80.0, m_blocksHeight));
        }
示例#2
0
 public override void      Render(GameRenderer gameRenderer, SpriteBatch spriteBatch)
 {
     if (m_visibleState)
     {
         base.Render(gameRenderer, spriteBatch, m_color);
     }
 }
示例#3
0
        public override void Render(GameRenderer gameRenderer, SpriteBatch spriteBatch)
        {
            Color color = GetCurrentColor();

            color.A = 255;

            if (!m_isVirtualAlien)
            {
                base.Render(gameRenderer, spriteBatch, color);
            }
        }
示例#4
0
 public override void Render(GameRenderer gameRenderer, SpriteBatch spriteBatch)
 {
     Render(gameRenderer, spriteBatch, new Color(0.0f, 1.0f, 0.0f));
 }
 public virtual void   Render(GameRenderer gameRenderer, SpriteBatch spriteBatch)
 {
     Render(gameRenderer, spriteBatch, Color.White);
 }
 public virtual void   Render(GameRenderer gameRenderer, SpriteBatch spriteBatch, Color color)
 {
     gameRenderer.RenderSprite(spriteBatch, m_texture, m_position, m_width, color);
 }