Пример #1
0
 public void PopulateInventory(ICharacter character, SpriteBatch spriteBatch)
 {
     IPickable[] inv = (character as Player).Inventory;
     for (int i = 0; i < inv.Length; i++)
     {
         if (inv[i] != null)
         {
             Texture2D uhm = GfxHandler.GetTexture(inv[i] as IGameObject);
             spriteBatch.Draw(uhm, new Vector2(slots[i].Position.X, slots[i].Position.Y), Color.White);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            this.GraphicsDevice.Clear(Color.Black);

            // Vector2 origin = new Vector2(GfxHandler.GetWidth(this.testPlayer) / 2, GfxHandler.GetHeight(this.testPlayer) / 2);
            // TODO: Add your drawing code here
            if (stages == GameStages.Game_Stage)
            {
                this.spriteBatch.Begin();


                this.testLevel.Assets.ForEach(t => this.spriteBatch.Draw(GfxHandler.GetTexture(t), t.Position));



                this.spriteBatch.End();
                this.statScreen.DrawHealth(this.testLevel.Character, this.Content, this.spriteBatch);
                GfxHandler.GetSprite(this.sampleEnemy).Draw(this.spriteBatch, this.sampleEnemy.Position);
                GfxHandler.GetSprite(this.testPlayer).Draw(this.spriteBatch, this.testPlayer.Position, this.testPlayer.FacingAngle, this.testPlayer.MovementAngle);

                foreach (var projectile in this.testLevel.Projectiles.ToList())
                {
                    GfxHandler.GetSprite(projectile).Draw(this.spriteBatch, projectile.Position, projectile.Angle);

                    if (projectile.Lifetime > projectile.Range)
                    {
                        this.testLevel.Projectiles.Remove(projectile);
                    }
                }
            }
            else if (this.stages == GameStages.Death_Stage)
            {
                this.statScreen.EndScreen(this.Content, this.spriteBatch);
            }
            else
            {
                this.staRtScreen.DrawStartScreen(this.spriteBatch, this.Content);
            }


            base.Draw(gameTime);
        }