Пример #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()
        {
            randomMap = new RandomMap(this, 3200, 300);
            player = new AssaultSoldier(this, randomMap, (this.GraphicsDevice.Viewport.Width / 2) - 32, 0f, 64, 128);
            camera = new Camera(this);
            Components.Add(player);

            this.bottomItemBar = new InventoryToolbar(this); //bottom inventory bar

            base.Initialize();
        }
Пример #2
0
        public override void draw(SpriteBatch spriteBatch, Character player)
        {
            spriteBatch.Begin(); //Used to draw UI on top of everything
            //spriteBatch.Draw(this.image, this.position, null, Color.White, 0, new Vector2(0, 0), 0.5f, SpriteEffects.None, 0); //draw toolbar
            string text = string.Format("Ammo : {0}", player.gun.currentAmmo);
            spriteBatch.DrawString(this.spriteFont, text, this.ammoTextPosition, Color.White); //draw ammo text

            //draw item icons in player's inventory
            for (int i = 0; i < player.inventory.Length; i++)
            {
                //draw 9 inventory slots
                spriteBatch.Draw(this.iconSlot, new Vector2(this.position.X + (i * this.iconSlot.Width / 2) + i * SLOT_GAP, this.position.Y), null, Color.White, 0, new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);
            }

            spriteBatch.End();
        }
Пример #3
0
 public virtual void draw(SpriteBatch spriteBatch, Character player)
 {
     spriteBatch.Begin(); //Used to draw UI on top of everything
     spriteBatch.Draw(this.image, this.position, Color.White);
     spriteBatch.End();
 }