// LOGIC public void SetSeed(int i_Seed) { TSRandom tsRandom = TSRandom.New(i_Seed); TSRandom.instance = tsRandom; m_Seed = i_Seed; }
private static void Shuffle <T>(IList <T> list) { TSRandom tsRandom = TSRandom.New(0); int count = list.Count; while (count > 1) { --count; int index = tsRandom.Next(0, count + 1); T obj = list[index]; list[index] = list[count]; list[count] = obj; } }
/// <summary> /// Do a deterministic Start to the Game. /// </summary> void managerstart() { TSRandom.instance = TSRandom.New(5); unitcon = GameObject.Find("Controllers"); unitcomscript = unitcon.GetComponent <UnitMovementcommandcontroller>(); unitcomscript.StartMain(); foreach (Transform gam in unitcon.transform) { if (gam.GetComponent <AIController>() != null) { aicontrollers.Add(gam.GetComponent <AIController>()); } } foreach (Transform t in Objects.transform) { if (t.name != "Working" && t.name != "Engines") { t.GetComponent <_Ship>().StartMain(); } } }
/// <summary> // initializes deterministic start. /// <summary> public void StartMain(int randominput) { int a = UnitMovementcommandcontroller.findspawnteamreverse(team); unitcontrol = transform.parent.GetComponent <UnitMovementcommandcontroller>(); crosslevelvar = unitcontrol.crosslevelholder; increaserate = getaimoneyamount(crosslevelvar.botdifficulty, unitcontrol.moneyincreaserate).AsInt(); if (unitcontrol.crosslevelholder.campaign == true && unitcontrol.crosslevelholder.campaignlevel.objective == MainMenuCampaignControlScript.eMissionObjective.Survive && unitcontrol.crosslevelholder.campaignlevel.name == "Final Assault") { increaserate = 80; } else if (unitcontrol.crosslevelholder.campaign == true && unitcontrol.crosslevelholder.campaignlevel.objective == MainMenuCampaignControlScript.eMissionObjective.Survive) { increaserate = 70; } World = GameObject.Find("World").transform.Find("Objects").gameObject; state = AIstate.attacking; debugseed = 5 + a + randominput; randominst = TSRandom.New(debugseed); startpos = new TSVector(0, 0, 0); spawnerhold = a; }
public AbstractForceController() : base(ControllerType.AbstractForceController) { this.Enabled = true; this.Strength = 1f; this.Position = new TSVector2(0, 0); this.MaximumSpeed = 100f; this.TimingMode = AbstractForceController.TimingModes.Switched; this.ImpulseTime = 0f; this.ImpulseLength = 1f; this.Triggered = false; this.StrengthCurve = new Curve(); this.Variation = 0f; this.Randomize = TSRandom.New(1234); this.DecayMode = AbstractForceController.DecayModes.None; this.DecayCurve = new Curve(); this.DecayStart = 0f; this.DecayEnd = 0f; this.StrengthCurve.Keys.Add(new CurveKey(0, 5)); this.StrengthCurve.Keys.Add(new CurveKey(0.1f, 5)); this.StrengthCurve.Keys.Add(new CurveKey(0.2f, -4)); this.StrengthCurve.Keys.Add(new CurveKey(1f, 0)); }
/// <summary> // deterministic start. /// <summary> public void StartMain(int inputint) { started = true; i = inputint; startcount = 0; customran = TSRandom.New(transform.parent.GetComponent <PhotonView>().viewID + inputint); parentscript = transform.parent.GetComponent <_Ship>(); if (guntypemain == guntype.EngineUpgrade) { parentscript.MaxSpeed = parentscript.MaxSpeed * 1.15f; } if (guntypemain == guntype.HPUpgrade) { parentscript.Armor = Mathf.RoundToInt(parentscript.Armor * 1.15f); } if (guntypemain == guntype.WeaponUpgrade) { foreach (Transform gun in transform.parent) { if (gun.tag == "Pickup") { _Weapon gunwep = gun.GetComponent <_Weapon>(); gunwep.timebetweenshots = gunwep.timebetweenshots * 1.15; } } } if (guntypemain == guntype.Cloak) { parentscript.iscloacked = true; } if (guntypemain == guntype.Tracker) { parentscript.isTracker = true; } unittargetcontrol = GameObject.Find("Controllers").GetComponent <UnitMovementcommandcontroller>(); poolmanager = GameObject.Find("F3dPoolManager").GetComponent <F3DPoolManager>(); team = parentscript.ShipColor; if (verticalmovechild == null && transform.childCount > 0 && transform.GetChild(0).childCount > 0) { verticalmovechild = transform.GetChild(0).GetChild(0).gameObject; } _Ship parent = transform.parent.GetComponent <_Ship>(); if (Cannon_Projectile != null) { parent.Cannon_Projectile = Cannon_Projectile; } if (Missile_Projectile != null) { parent.Missile_Projectile = Missile_Projectile; } if (MiniGun_Projectile != null) { parent.MiniGun_Projectile = MiniGun_Projectile; } if (Lazer_Proectile != null) { parent.Lazer_Shot = Lazer_Proectile; } parent.shieldmaterial = shieldmatgam; damage = Calculate_damage(); audiosource = GetComponent <AudioSource>(); WorldBase = GameObject.Find("WorldScaleBase"); timepassed = 0; }