예제 #1
0
        public static ChainedRandomizer <BubbleType>[] CreateRandomizers(System.Random rng,
                                                                         RandomBubbleDefinition[] randoms)
        {
            var count  = randoms.Length;
            var result = new ChainedRandomizer <BubbleType> [count];

            for (var index = 0; index < count; index++)
            {
                var group = randoms[index];

                result[index] = new ChainedRandomizer <BubbleType>(
                    rng,
                    group.rollType,
                    BaseBubbleQueue.LAUNCHER_BUBBLE_TYPES,
                    group.weights.Select(w => (float)w)
                    );
            }

            for (var index = 0; index < count; index++)
            {
                foreach (var exclusion in randoms[index].exclusions)
                {
                    result[index].AddExclusion(result[exclusion]);
                }
            }

            return(result);
        }
예제 #2
0
        public void AddExclusion(ChainedRandomizer <T> other)
        {
            if (other.method == SelectionMethod.Each)
            {
                throw new ArgumentException(
                          "Only randomizers with the Once selection method can be used as exclusions."
                          );
            }

            exclusions = exclusions ?? new List <ChainedRandomizer <T> >();
            exclusions.Add(other);
            Reset();
        }