using System; using System.Collections.Generic; using System.Linq; namespace DunGen.Graph { [Serializable] public class GraphLine { public DungeonFlow Graph; public List DungeonArchetypes = new List(); public float Position; public float Length; public List Keys = new List(); public List Locks = new List(); public GraphLine(DungeonFlow graph) { Graph = graph; } public DungeonArchetype GetRandomArchetype(RandomStream randomStream, IList usedArchetypes) { IEnumerable source = DungeonArchetypes.Where((DungeonArchetype a) => !a.Unique || !usedArchetypes.Contains(a)); if (!source.Any()) { source = DungeonArchetypes; } int index = randomStream.Next(0, source.Count()); return source.ElementAt(index); } } }