// Start is called before the first frame update void Start() { puzzlePool = new SelectorPool <string>(puzzles) { AutoRefill = true, SelectLimit = PuzzleLimit }; }
protected override void ResetToDefaultsAfterStorage() { Storage.SelectorPools = new Dictionary <string, SelectorPool <object> >(); using (StringReader textReader = new StringReader(textAsset.text)) { string line, name = ""; PoolsLoadState state = PoolsLoadState.EMPTY; SelectorPool <object> selectorPool = null; while ((line = textReader.ReadLine()) != null) { switch (state) { case PoolsLoadState.EMPTY: if (selectorPool == null) { selectorPool = new SelectorPool <object>() { AutoRefill = AutoRefillPools }; } if (!string.IsNullOrEmpty(line)) { name = line.Trim(); state = PoolsLoadState.NAME; } break; case PoolsLoadState.NAME: if (line == NameValuesSeparator) { state = PoolsLoadState.POOLS; } break; case PoolsLoadState.POOLS: if (line == PoolSeparator) { if (FillPoolsOnLoad) { selectorPool.Fill(); } Storage.SelectorPools.Add(name, selectorPool); state = PoolsLoadState.EMPTY; selectorPool = null; } else { selectorPool.Pool.Add(line); } break; } } } }