public virtual Item Construct() { int index = Utility.Random(m_Weight); for (int i = 0; i < m_Entries.Length; ++i) { FillableEntry entry = m_Entries[i]; if (index < entry.Weight) { return(entry.Construct()); } index -= entry.Weight; } return(null); }
public FillableContent(int level, Type[] vendors, FillableEntry[] entries) { this.m_Level = level; this.m_Vendors = vendors; this.m_Entries = entries; for (int i = 0; i < entries.Length; ++i) this.m_Weight += entries[i].Weight; }
public FillableContent(int level, Type[] vendors, FillableEntry[] entries) { m_Level = level; m_Vendors = vendors; m_Entries = entries; m_Weight += entries.Sum(e => e.Weight); }