Ejemplo n.º 1
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            StateManager.GetState(1).Draw(spriteBatch);

            /*if (selected >= 0)
             * {
             *  if (canMove[selected])
             *  {
             *      for (int i = 0; i < canMoveTo.Count; i++)
             *      {
             *          spriteBatch.DrawRectangle(new Rectangle(Grid.ToPixelLocation(new Point((int)canMoveTo[i].X, (int)canMoveTo[i].Y), Globals.GridLocation, Globals.TileDimensions).X, Grid.ToPixelLocation(new Point((int)canMoveTo[i].X, (int)canMoveTo[i].Y), Globals.GridLocation, Globals.TileDimensions).Y, Globals.TILE_WIDTH, Globals.TILE_HEIGHT), Color.BlueViolet * .50f);
             *      }
             *  }
             * }/**/

            statsUI.Draw(spriteBatch);
        }
Ejemplo n.º 2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            // Draw background
            spriteBatch.DrawE2DTexture(background, Vector2.Zero);

            spriteBatch.DrawRectangle(Vector2.Zero, Main.WindowWidth, GridArea.Top, backgroundOverColor);
            spriteBatch.DrawRectangle(new Vector2(0, GridArea.Top), GridArea.Left, GridArea.Height, backgroundOverColor);
            spriteBatch.DrawRectangle(new Vector2(GridArea.Right, GridArea.Top), Main.WindowWidth - GridArea.Right, GridArea.Height, backgroundOverColor);
            spriteBatch.DrawRectangle(new Vector2(0, GridArea.Bottom), Main.WindowWidth, Main.WindowHeight - GridArea.Bottom, backgroundOverColor);

            // UI
            statsUI.Draw(spriteBatch);
            armyShowCase.Draw(spriteBatch);
            armyName.Draw(spriteBatch);

            // Draw all character chips
            foreach (Character c in Armies.army)
            {
                if (!drag || selectedCharacter != c)
                {
                    c.Draw(spriteBatch);
                }
            }

            // Draw selected character
            if (drag)
            {
                int W = selectedCharacter.sprite.sourceRectangle.Width / 2;
                int H = selectedCharacter.sprite.sourceRectangle.Height / 2;

                Vector2 dragPos = Globals.mouseState.Position - new Vector2(W, H);
                dragPos.X = MathHelper.Clamp(dragPos.X, GridArea.Left - W, GridArea.Right - W);
                dragPos.Y = MathHelper.Clamp(dragPos.Y, GridArea.Top - H, GridArea.Bottom - H);

                spriteBatch.DrawSprite(selectedCharacter.sprite, dragPos);
            }

            foreach (KeyValuePair <Character.Rank, Sprite> entry in armyDict)
            {
                entry.Value.Draw(spriteBatch);

                if (selectedCharacter.rank != entry.Key)
                {
                    switch (entry.Key)
                    {
                    case Character.Rank.Miner:
                    case Character.Rank.Spy:
                    case Character.Rank.Healer:
                        if (selectedCharacter.special == Character.Special.None || selectedCharacter.rank == Character.Rank.Bomb)
                        {
                            goto default;
                        }
                        break;

                    default:
                        Sprite clone = (Sprite)entry.Value.Clone();
                        clone.colorEffect = Color.Black * .78f;
                        clone.Draw(spriteBatch);
                        break;
                    }
                }
            }
        }