Пример #1
0
 private void DrawCityEdges()
 {
     if (ShowCityEdges)
     {
         PrimitiveDrawing.DrawPolygon(spriteBatch, Utils.BlankTexture, 3, Color.Aqua, Camera.RelativeToCamera(this.MapPolygon));
     }
 }
Пример #2
0
 protected override void LoadContent()
 {
     _primitiveBatch   = new PrimitiveBatch(GraphicsDevice);
     _primitiveDrawing = new PrimitiveDrawing(_primitiveBatch);
     _localProjection  = Matrix.CreateOrthographicOffCenter(0f, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0f, 0f, 1f);
     _localView        = Matrix.Identity;
 }
Пример #3
0
 private void DrawCityBlockEdges()
 {
     if (ShowBlockEdges)
     {
         foreach (DrawableCityBlock cb in this.Blocks)
         {
             PrimitiveDrawing.DrawPolygon(spriteBatch, Utils.BlankTexture, 1, Color.Red, Camera.RelativeToCamera(cb.CityBlock.TopPolygon));
         }
     }
 }
Пример #4
0
        public void DrawCityBlocksAndBuildings()
        {
            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    DrawableCityBlock block = Blocks[x, y];

                    spriteBatch.Draw(block.Texture, Camera.RelativeToCamera(block.CityBlock.Position),
                                     Color.White);

                    if (ShowBlockEdges)
                    {
                        PrimitiveDrawing.DrawPolygon(spriteBatch, Utils.BlankTexture, 1, Color.Red, Camera.RelativeToCamera(block.CityBlock.TopPolygon));
                    }

                    if (!block.IsBuildable)
                    {
                        Rectangle teste = new Rectangle(block.CityBlock.Position.X, block.CityBlock.Position.Y, selectionTexture.Width, selectionTexture.Height);
                        spriteBatch.Draw(selectionTexture, Camera.RelativeToCamera(teste), Color.Red);
                    }

                    Rectangle teste2 = Camera.RelativeToCamera(block.CityBlock.Position);
                    Vector2   v      = new Vector2(teste2.X + 20, teste2.Y + 10);

                    if (block.Building == null)
                    {
                        spriteBatch.DrawString(spriteFont, block.Coordinates, v, Color.Black);
                    }

                    if (block.IsReferenceForBuilding && block.Building != null)
                    {
                        spriteBatch.DrawString(spriteFont, "R", v, Color.Black);
                    }
                    else if (!block.IsReferenceForBuilding && block.Building != null)
                    {
                        spriteBatch.DrawString(spriteFont, "B", v, Color.Black);
                    }
                }
            }

            if (ShowBuildings)
            {
                for (int y = 0; y < Height; y++)
                {
                    int tmpY = y;
                    for (int x = 0; tmpY >= 0; x++)
                    {
                        DrawableCityBlock block = Blocks[x, tmpY];

                        if (block.Building != null && !block.IsReferenceForBuilding)
                        {
                            spriteBatch.Draw(block.Building.Texture, Camera.RelativeToCamera(block.Building.Location), Color.White);
                        }

                        tmpY--;
                    }
                }

                int startX = 1;

                do
                {
                    int tmpY = Height - 1;
                    for (int x = startX; x < Width; x++)
                    {
                        DrawableCityBlock block = Blocks[x, tmpY];

                        if (block.Building != null && !block.IsReferenceForBuilding)
                        {
                            spriteBatch.Draw(block.Building.Texture, Camera.RelativeToCamera(block.Building.Location), Color.White);
                        }

                        tmpY--;
                    }

                    startX++;
                } while (startX < Width);
            }
        }