/********* ** Public methods *********/ /// <summary>Get all machine groups in a location.</summary> /// <param name="location">The location to search.</param> /// <param name="reflection">Simplifies access to private game code.</param> public IEnumerable <MachineGroup> GetMachineGroups(GameLocation location, IReflectionHelper reflection) { MachineGroupBuilder builder = new MachineGroupBuilder(location); ISet <Vector2> visited = new HashSet <Vector2>(); foreach (Vector2 tile in location.GetTiles()) { this.FloodFillGroup(builder, location, tile, visited, reflection); if (builder.HasTiles()) { yield return(builder.Build()); builder.Reset(); } } }
/// <summary>Get all machine groups in a location.</summary> /// <param name="location">The location to search.</param> public IEnumerable <MachineGroup> GetMachineGroups(GameLocation location) { MachineGroupBuilder builder = new MachineGroupBuilder(location, this.Config); LocationFloodFillIndex locationIndex = new LocationFloodFillIndex(location); ISet <Vector2> visited = new HashSet <Vector2>(); foreach (Vector2 tile in location.GetTiles()) { this.FloodFillGroup(builder, location, tile, locationIndex, visited); if (builder.HasTiles()) { yield return(builder.Build()); builder.Reset(); } } }