Ejemplo n.º 1
0
        private static void DrawRailRoad(ref Picture output, ITile tile, bool graphics16 = false)
        {
            if (!tile.RailRoad && tile.City == null)
            {
                return;
            }

            bool  connected  = false;
            ITile borderTile = null;

            Direction[] directions = new [] { Direction.North, Direction.NorthEast, Direction.East, Direction.SouthEast, Direction.South, Direction.SouthWest, Direction.West, Direction.NorthWest };
            for (int i = 0; i < directions.Length; i++)
            {
                if ((borderTile = tile.GetBorderTile(directions[i])) == null)
                {
                    continue;
                }
                // if (!borderTile.Road || borderTile.RailRoad || (tile.City != null && borderTile.City != null)) continue;
                if (!borderTile.Road || borderTile.RailRoad || borderTile.City != null)
                {
                    continue;
                }
                output.AddLayer(Res.GetPart(graphics16 ? "SPRITES" : "SP257", (i * 16), 48, 16, 16), 0, 0);
                connected = true;
            }
            for (int i = 0; i < directions.Length; i++)
            {
                if ((borderTile = tile.GetBorderTile(directions[i])) == null)
                {
                    continue;
                }
                if (!borderTile.RailRoad && tile.City == null && borderTile.City == null)
                {
                    continue;
                }
                if (tile.City != null && borderTile.City == null && !borderTile.RailRoad)
                {
                    continue;
                }
                output.AddLayer(Res.GetPart(graphics16 ? "SPRITES" : "SP257", 128 + (i * 16), 96, 16, 16), 0, 0);
                connected = true;
            }
            if (connected)
            {
                return;
            }
            output.FillRectangle(5, 7, 7, 2, 2);
        }
Ejemplo n.º 2
0
 public bool Visible(ITile tile, Direction direction)
 {
     if (tile == null)
     {
         return(false);
     }
     return(Visible(tile.GetBorderTile(direction)));
 }