示例#1
0
        private static void ProccessAllNeighboursOfTile(IMap map, IList <EmptyAreaGroup> result, ITile currentTile)
        {
            var currentGroup = new EmptyAreaGroup();

            currentGroup.Add(currentTile);

            AddNeighboursToGroup(map, currentTile, currentGroup);
            result.Add(currentGroup);
        }
示例#2
0
        private static void AddNeighboursToGroup(IMap map, ITile currentTile, EmptyAreaGroup currentGroup)
        {
            var neighboursOfCurrentTile = map.GetNeighboursOf(currentTile, NeighbourMode.ByWall).Where(a => a.TileState == TileState.Empty);

            foreach (var neighbour in neighboursOfCurrentTile)
            {
                if (!currentGroup.Tiles.Contains(neighbour))
                {
                    currentGroup.Add(neighbour);

                    AddNeighboursToGroup(map, neighbour, currentGroup);
                }
            }
        }