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 AddMod(RoomModifier mod, double multiplier, bool unique = false) { if (mod is BaseRoomMod) { BaseMods.Add((BaseRoomMod)mod, multiplier, unique || mod.Unique); } else if (mod is DefiningRoomMod) { DefiningMods.Add((DefiningRoomMod)mod, multiplier, unique || mod.Unique); } else if (mod is HeavyRoomMod) { HeavyMods.Add((HeavyRoomMod)mod, multiplier, unique || mod.Unique); } else if (mod is FillRoomMod) { FillMods.Add((FillRoomMod)mod, multiplier, unique || mod.Unique); } else if (mod is FinalRoomMod) { FinalMods.Add((FinalRoomMod)mod, multiplier, unique || mod.Unique); } else { throw new ArgumentException("Cannot inherit directly from RoomModifier"); } }
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; }
private static void AddMod(SpawnModifier mod) { mods.Add(mod); }
public override void Add(T item, double multiplier, bool unique) { _pool.Add(item, multiplier, unique); }