protected void Clear() { if (curLevel != -1) { currentPool = ProbabilityPool <T> .Create(); curLevel = -1; } }
static PrimitiveCombiner() { defaultPrimitives = ProbabilityPool <BaseRoomMod> .Create(); defaultPrimitives.Add(new CircleRoom(), .5, true); defaultPrimitives.Add(new SquareRoom(), 1); defaultPrimitives.Add(new RectangularRoom(), 1.5); defaultAmount = ProbabilityPool <byte> .Create(); defaultAmount.Add(2, 5); defaultAmount.Add(3, 1); defaultAmount.Add(4, .4); }
public void Init() { _pool = ProbabilityPool <ThemeElement> .Create(); foreach (PrefabProbabilityContainer cont in Elements) { if (cont.Item == null) { throw new ArgumentException("Prefab has to be not null"); } if (cont.Multiplier <= 0) { cont.Multiplier = 1f; } _pool.Add(cont.Item, cont.Multiplier, cont.Unique); } }
public void Init() { _pool = ProbabilityPool <T> .Create(); foreach (PrefabProbabilityContainer cont in Elements) { if (cont.Item == null) { throw new ArgumentException("Prefab has to be not null"); } T t = cont.Item.GetComponentInChildren <T>(); if (t == null) { throw new ArgumentException("Prefab of type " + cont.Item.GetType() + " has to be of type " + typeof(T)); } _pool.Add(t, cont.Multiplier, cont.Unique); } }
public void SetFor(ushort level) { if (curLevel == level) { return; } currentPool = ProbabilityPool <T> .Create(); foreach (ProbContainer prototype in prototypePool) { double multiplier = levelCurve(level, prototype.Level); multiplier = prototype.Multiplier * multiplier; if (multiplier < MAX_MULTIPLIER && multiplier > MIN_MULTIPLIER) { currentPool.Add(prototype.Item, multiplier, prototype.Unique); } } curLevel = level; }