Exemple #1
0
        /// <summary>
        ///   Instantiate the enumerator to loop through what is left in the bag.
        ///   If the bag was emptied, fills it again.
        /// </summary>
        public ShuffleBagEnumerator(ShuffleBag <T2> sourceBag)
        {
            this.sourceBag = sourceBag;

            // If the shuffle bag is empty, just fill and shuffle it, else just use whatever is left in it.
            if (sourceBag.currentContent.Count == 0 && sourceBag.automaticRefill)
            {
                sourceBag.FillAndShuffle();
            }
        }
Exemple #2
0
 /// <summary>
 ///   Resets the bag, effectively making it a full and shuffled bag again.
 /// </summary>
 public void Reset()
 {
     sourceBag.FillAndShuffle();
 }