Esempio n. 1
0
 protected void DrawDebugPathFindingGrid(GameContext context, XnaGraphics graphics)
 {
     for (int x = 0; x < this.m_PathFindingGrid.GetLength(0); x++)
         for (int y = 0; y < this.m_PathFindingGrid.GetLength(1); y++)
             if (this.m_PathFindingGrid[x, y] == (byte)PathFinderHelper.BLOCKED_TILE)
                 graphics.DrawRectangle(new Rectangle(x * 16, y * 16, 16, 16), new Color(255, 0, 0, 128));
             else if (this.m_PathFindingGrid[x, y] == (byte)PathFinderHelper.EMPTY_TILE)
                 graphics.DrawRectangle(new Rectangle(x * 16, y * 16, 16, 16), new Color(0, 255, 0, 128));
             else
                 graphics.DrawRectangle(new Rectangle(x * 16, y * 16, 16, 16), new Color(0, 0, 255, 128));
 }
Esempio n. 2
0
        public void Draw(RTSWorld world, GameContext context, XnaGraphics graphics)
        {
            this.Update(world, context);

            graphics.DrawStringLeft(0, 0, world.ActiveLevel.GetType().Name);
            graphics.DrawStringLeft(0, 32, this.m_Tick.ToString());

            if (this.m_LastMousePoint.HasValue && this.m_CurrentMousePoint.HasValue)
                graphics.DrawRectangle(this.m_LastMousePoint.Value, this.m_CurrentMousePoint.Value, Color.LimeGreen);

            foreach (Unit u in this.Selected)
            {
                Rectangle bb = new Rectangle((int)u.X, (int)u.Y - 1, u.Width + 1, u.Height + 1);
                if (u.Team != null)
                    graphics.DrawRectangle(bb, u.Team.Color);
                else
                    graphics.DrawRectangle(bb, Color.LimeGreen);
            }

            // Draw chat.
            int a = 16;
            for (int i = this.m_ChatMessages.Count - 1; i >= Math.Max(this.m_ChatMessages.Count - 11, 0); i--)
            {
                if (i < this.m_ChatMessages.Count)
                    graphics.DrawStringLeft(0, context.Graphics.GraphicsDevice.Viewport.Height - a, this.m_ChatMessages[i]);
                a += 16;
            }

            // Draw graph.
            if (this.m_GraphFrames.Count > 1)
            {
                for (int i = 1; i < this.m_GraphFrames.Count; i++)
                    graphics.DrawLine(i - 1, (float)this.m_GraphFrames[i - 1], i, (float)this.m_GraphFrames[i], 1, Color.Lime);
            }

            // Add frame information.
            if (this.m_GraphFrames.Count > 200)
                this.m_GraphFrames.RemoveAt(0);
            this.m_GraphFrames.Add(context.GameTime.ElapsedGameTime.TotalMilliseconds);

            this.m_Tick++;
        }