Example #1
0
        public void ConnectEdgeWalls(GeneratingTileInfo other, Direction directionToOther)
        {
            var edges      = this.edgeWalls[directionToOther];
            var otherEdges = other.edgeWalls[directionToOther.Opposite()];

            edges.ConnectWalls(otherEdges);
        }
Example #2
0
        private static Tuple <Vector2, Vector2> makeWallPoints(Direction direction, float width)
        {
            var corner1 = direction.CornerBefore() * Settings.Game.Level.HexagonSide;
            var corner2 = direction.CornerAfter() * Settings.Game.Level.HexagonSide;

            float halfWidth = width * 0.5f;

            return(Tuple.Create(
                       Vector2.Lerp(corner1, corner2, 0.5f - halfWidth),
                       Vector2.Lerp(corner1, corner2, 0.5f + halfWidth)
                       ));
        }
Example #3
0
        public static bool OpenTileWall(this Tile <GeneratingTileInfo> tile, Direction direction, float width)
        {
            var other = tile.Neighbour(direction);

            if (!other.IsValid)
            {
                return(false);
            }

            var info  = tile.Info;
            var info2 = other.Info;

            var oppositeDir = direction.Opposite();

            info.OpenSides  = info.OpenSides.And(direction);
            info2.OpenSides = info2.OpenSides.And(oppositeDir);

            info.CorridorWidths[(int)direction]    = width;
            info2.CorridorWidths[(int)oppositeDir] = width;

            return(true);
        }
Example #4
0
 public static bool OpenTileWall(this Tile <GeneratingTileInfo> tile, Direction direction, float minOpen, float maxOpen)
 {
     return(tile.OpenTileWall(direction, GlobalRandom.NextFloat(minOpen, maxOpen)));
 }