示例#1
0
    public static SpawnModifier GetMod()
    {
        SpawnModifier mod;

        mods.Get(Probability.SpawnRand, out mod);
        return(mod);
    }
示例#2
0
    public void Test <T>(ProbabilityPool <T> pool, int max, bool print)
    {
        System.Random random = new System.Random();
        pool.Freshen();
        Dictionary <T, int> dict = new Dictionary <T, int>();

        for (int i = 0; i < max; i++)
        {
            T   c = pool.Get(random);
            int num;
            if (!dict.TryGetValue(c, out num))
            {
                num = 0;
            }
            num++;
            if (print)
            {
                BigBoss.Debug.w(Logs.Main, "Picked " + num + " " + c);
            }
            dict[c] = num;
        }

        pool.ToLog(Logs.Main);

        BigBoss.Debug.w(Logs.Main, "Real probability out of " + max);
        foreach (KeyValuePair <T, int> pair in dict)
        {
            BigBoss.Debug.w(Logs.Main, "  " + pair.Key + ": " + ((double)pair.Value / max * 100d) + " - " + pair.Value);
        }
    }
示例#3
0
 public static DrawAction <GenSpace> MergeIn <T>(ProbabilityPool <T> elements, System.Random random, Theme theme, GridType type = GridType.Doodad, bool typeOnlyDefault = false, bool themeOnlyDefault = false)
     where T : ThemeElement
 {
     return((arr, x, y) =>
     {
         MergeIn(arr, x, y, new GenDeploy(elements.Get(random)), theme, type, typeOnlyDefault, themeOnlyDefault);
         return true;
     });
 }
示例#4
0
    protected override bool ModifyInternal(RoomSpec spec, double scale)
    {
        _amounts.Freshen();
        _primitives.Freshen();
        byte amount             = _amounts.Get(spec.Random);
        List <BaseRoomMod> mods = _primitives.Get(spec.Random, amount);

        throw new NotImplementedException("");
        return(true);
    }
示例#5
0
 public SmartThemeElement Select(System.Random rand)
 {
     SmartElement = _pool.Get(rand);
     return(SmartElement);
 }
 public override bool Get(System.Random random, out T item)
 {
     return(_pool.Get(random, out item));
 }
示例#7
0
 public bool Get(System.Random random, out T item, ushort level)
 {
     SetFor(level);
     return(currentPool.Get(random, out item));
 }