Пример #1
0
        public void DrawTroop(SpriteBatch spriteBatch, GameState gameState)
        {
            base.DrawFactory(spriteBatch, gameState);

            List<Troop> troops = gameState.getTroops();

            for(int i = 0; i < troops.Count; i++)
            {
                if (troops[i].Fighting)
                {
                    Vector2 troopOrigin = new Vector2(battle.Width * 0.5f, battle.Height * 0.5f);
                    spriteBatch.Draw(battle, troops[i].CurrentPos, null, Color.White, troops[i].Rotation, troopOrigin, 1.0f, SpriteEffects.None, 1.0f);
                }
                else if (troops[i].ObjectType == 1)
                {
                    Vector2 troopOrigin = new Vector2(blue_tank.Width * 0.5f, blue_tank.Height * 0.5f);
                    spriteBatch.Draw(blue_tank, troops[i].CurrentPos, null, Color.White, troops[i].Rotation, troopOrigin, 1.0f, SpriteEffects.None, 1.0f);
                }
                else
                {
                    Vector2 troopOrigin = new Vector2(red_tank.Width * 0.5f, red_tank.Height * 0.5f);
                    spriteBatch.Draw(red_tank, troops[i].CurrentPos, null, Color.White, troops[i].Rotation, troopOrigin, 1.0f, SpriteEffects.None, 1.0f);
                }

                spriteBatch.DrawString(font, troops[i].Elements.ToString(), troops[i].CurrentPos, Color.Yellow);
            }
        }