public NormalRoom(NormalRoom prev, Random rand, bool noEvil) { var indexes = Enumerable.Range(0, roomTemplates.Length).ToList(); rand.Shuffle(indexes); foreach (var index in indexes) { if (prev != null && index == prev.currentId) continue; if ((roomTemplates[index].Flags & RoomFlags.Evil) != 0 && noEvil) continue; if (prev != null) { bool ok = false; foreach (var conn in prev.ConnectionPoints) { var d = conn.Item1.Reverse(); if (roomTemplates[index].Connections.Any(targetConn => targetConn.Item1 == d)) { ok = true; break; } } if (!ok) continue; } currentId = index; } current = roomTemplates[currentId]; }
public override Room CreateNormal(int depth, Room prev) { var rm = new NormalRoom(prev as NormalRoom, Rand, generatedEvilRoom); if ((rm.Flags & NormalRoom.RoomFlags.Evil) != 0) generatedEvilRoom = true; return rm; }