public virtual void Think() { if (!IsAlive) { return; } if (TimeDeath > 0 && TimeDeath < World.Time) { this.PendingDestruction = true; } if (IsGearhead && Fleet.Ships.Count < 15) { var r = new Random(); if (r.NextDouble() < World.Hook.GearheadRegen) { Fleet.AddShip(); } } if (this.IsControlNew) { if (float.IsNaN(ControlInput.Position.X)) { ControlInput.Position = new System.Numerics.Vector2(0, 0); } Fleet.AimTarget = ControlInput.Position; Fleet.BoostRequested = CummulativeBoostRequested; Fleet.ShootRequested = CummulativeShootRequested; CummulativeBoostRequested = false; CummulativeShootRequested = false; Fleet.CustomData = ControlInput.CustomData; if (Fleet.CustomData != null) { var parsed = JsonConvert.DeserializeAnonymousType(Fleet.CustomData, new { magic = null as string }); if (parsed?.magic != null) { JsonConvert.PopulateObject(parsed.magic, this); } } } if (this.Backgrounded) { Fleet.AimTarget = Vector2.Zero; } this.IsControlNew = false; if (IsInvulnerable) { if (!this.Fleet.FiringWeapon && CummulativeShootRequested && this.Fleet.ShootCooldownStatus == 1) { IsInvulnerable = false; } if (World.Time > InvulnerableUntil) { IsInvulnerable = false; } if (!IsInvulnerable) { IsShielded = false; foreach (var ship in Fleet?.Ships) { ship.ShieldStrength = 0; } } } }
public virtual void Think() { if (!IsAlive) { return; } if (TimeDeath > 0 && TimeDeath < World.Time) { this.PendingDestruction = true; } if (IsGearhead && Fleet.Ships.Count < 15) { var r = new Random(); if (r.NextDouble() < World.Hook.GearheadRegen) { Fleet.AddShip(); } } if (this.IsControlNew) { if (float.IsNaN(ControlInput.Position.X)) { ControlInput.Position = new System.Numerics.Vector2(0, 0); } Fleet.AimTarget = ControlInput.Position; Fleet.BoostRequested = CummulativeBoostRequested; Fleet.ShootRequested = CummulativeShootRequested; CummulativeBoostRequested = false; CummulativeShootRequested = false; Fleet.CustomData = ControlInput.CustomData; } this.IsControlNew = false; if (IsInvulnerable) { if (!this.Fleet.FiringWeapon && CummulativeShootRequested && this.Fleet.ShootCooldownStatus == 1) { IsInvulnerable = false; } if (World.Time > InvulnerableUntil) { IsInvulnerable = false; } if (!IsInvulnerable) { IsShielded = false; foreach (var ship in Fleet?.Ships) { ship.ShieldStrength = 0; } } } }