public static bool TryGetRoom( int width, int height, FloorGenData genData, out PrefabRoom room, TagSetCheck setCheck) { if (_sizeTable.ContainsKey(new Vector2Int(width, height))) { // there is a room of that size foreach (var r in _sizeTable[new Vector2Int(width, height)].AsArray().EnumerateRandom()) { if (genData.PlacedRooms.Contains(r)) { continue; } bool valid = true; foreach (var myTag in r.Tags) { if (genData.ExcludedTags.ContainsKey(myTag)) { valid = false; break; } } if (!valid) { continue; } foreach (var exTag in r.ExcludeTags) { if (genData.ExistingTags.ContainsKey(exTag)) { valid = false; break; } } if (!valid) { continue; } var hash = r.HashTags; foreach (var check in genData.RequiredChecks) { if (!check[hash]) { valid = false; break; } } if (valid && setCheck[hash]) { room = r; return(true); } } } room = null; return(false); }
public void AddCheck(TagSetCheck check) { RequiredChecks.Add(check); }