Пример #1
0
 /// <summary>
 /// Create a new player
 /// </summary>
 /// <param name="input">The input manager of the game</param>
 /// <param name="bar">The infobar, player handles displaying and hiding the infobar</param>
 public Human(InfoBar bar, UpdateBox box, Texture2D sprite, Army a)
 {
     changeTurn = false;
     mapControl = true;
     infoBar = bar;
     updateBox = box;
     endTurnButton = box.EndTurnButton;
     currentGridX = 2;
     currentGridY = 2;
     texture = sprite;
     ownArmy = a;
     mainSelector = new Selector(tiles, actualPos, sprite, currentGridX, currentGridY);
     secondarySelector = new Selector(tiles, actualPos, sprite, currentGridX, currentGridY);
     highlightGone = true;
     //texture = Game1.GameContent.Load<Texture2D>("generic_unit");
 }
Пример #2
0
 /// <summary>
 /// Draw the battle (draws tiles)
 /// </summary>
 /// <param name="spriteBatch"></param>
 public void Draw(SpriteBatch spriteBatch, InfoBar infoBar, UpdateBox updateBox, Camera2D camera)
 {
     /*for(int i = 0; i < _mapSize * _mapSize; i++)
             _tiles[i].Draw(spriteBatch);*/
     for (int i = 0; i < mapSize; i++)
     {
         for (int j = 0; j < mapSize; j++)
         {
             tiles[i, j].Draw(spriteBatch);
         }
     }
     if (players[turn] is Human)
     {
         (players[turn] as Human).Draw(spriteBatch);
     }
 }
Пример #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            infoBar = new InfoBar(camera);
            updateBox = new UpdateBox();

            battleBG = Game1.GameContent.Load<Texture2D>("battleBG");

            menuButtons = Game1.GameContent.Load<Texture2D>("ButtonsSpriteSheet");      // initialize texture array to the number of menu items

            /*
            testArmy = new Army();
            testArmy.Units.Add(new Infantry(infantryTexture));
            testArmy.Units.Add(new Infantry(infantryTexture));
            testArmy.Units.Add(new Infantry(infantryTexture));
            armyArray = new Army[2];
            armyArray[0] = testArmy;
            player = new Player(infoBar, playerSheet, testArmy);
            player.RectPos = new Rectangle(64, 64, 32, 32);
            eTestArmy = new Army();
            eTestArmy.Units.Add(new Infantry(infantryTexture));
            eTestArmy.Units.Add(new Infantry(infantryTexture));
            eTestArmy.Units.Add(new Infantry(infantryTexture));
            foreach (Unit u in eTestArmy.Units)
                u.Enemy = true;
            armyArray[1] = eTestArmy;
            */

            //camera.Focus = player;
        }