public static Bomb Generate(int modules, GeneratorSettings settings) { Bomb result = new Bomb(modules); result.BombInfo = new BombInfo(); result.BombInfo.Init(); for (int i = 0; i < modules; i++) { if (RandomUtil.Double() <= settings.VanillaPercentage) { result.Modules[i] = ModulePools.Vanilla.Random(); } else { result.Modules[i] = ModulePools.Mods.Random(); } result.Modules[i].BombInfo = result.BombInfo; result.Modules[i].ModuleID = i + 1; } for (int i = 0; i < modules; i++) { result.Modules[i].Init(); } return(result); }
public IndicatorWidget() { int pos = RandomUtil.Int(0, possibleValues.Count); val = possibleValues[pos]; possibleValues.RemoveAt(pos); on = RandomUtil.Double() > 0.4f; Debug.Log("Added indicator widget: " + val + " is " + (on ? "ON" : "OFF")); }
public PortWidget() { ports = new List <string>(); string portList = ""; if (RandomUtil.Double() > 0.5) { if (RandomUtil.Double() > 0.5) { ports.Add("Parallel"); portList += "Parallel"; } if (RandomUtil.Double() > 0.5) { ports.Add("Serial"); if (portList.Length > 0) { portList += ", "; } portList += "Serial"; } } else { if (RandomUtil.Double() > 0.5) { ports.Add("DVI"); portList += "DVI"; } if (RandomUtil.Double() > 0.5) { ports.Add("PS2"); if (portList.Length > 0) { portList += ", "; } portList += "PS2"; } if (RandomUtil.Double() > 0.5) { ports.Add("RJ45"); if (portList.Length > 0) { portList += ", "; } portList += "RJ45"; } if (RandomUtil.Double() > 0.5) { ports.Add("StereoRCA"); if (portList.Length > 0) { portList += ", "; } portList += "StereoRCA"; } } if (portList.Length == 0) { portList = "Empty plate"; } Debug.Log("Added port widget: " + portList); }