public override void Destroy() { this.Armed = true; Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y()); for (int i = 0; i < 30; i++) { ParticleManager.CreateParticle(Position3, Rand.V3() * 600, ParticleColor, 30, 5); } for (int i = 0; i < 2; i++) { FlareSystem.AddLightingPoint(Position3, new Vector3(0.3f), new Vector3(0, 0, 1), 25, 40, 5, 10); ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 1200, 5); ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400, 4); } QuadGrid quadGrid = Parent2DScene.quadGrids.First.Value; foreach (GameObject g in quadGrid.Enumerate(Position.get(), new Vector2(WinderMisslesAbility.ExplosionDistance))) { if (g.GetType().IsSubclassOf(typeof(UnitShip))) { UnitShip s = (UnitShip)g; if (Vector2.Distance(Position.get(), s.Position.get()) < WinderMisslesAbility.ExplosionDistance / 4) { s.StunState = AttackType.White; s.FreezeTime = 1000; s.SetSpeed(Vector2.Normalize(s.Position.get() - Position.get()) * 12 / s.Mass); } } } base.Destroy(); }
public override void Update(GameTime gameTime) { if (!Dead) { if (ShutDownTime > 0 || VirusTime > 0) { ShutDownTime = 0; VirusTime = 0; } else { SearchTime += gameTime.ElapsedGameTime.Milliseconds; if (SearchTime > PulseSearchTime) { SearchTime -= PulseSearchTime; bool Found = false; QuadGrid quad = Parent2DScene.quadGrids.First.Value; foreach (Basic2DObject o in quad.Enumerate(Position.get(), new Vector2(MaxEngagementDistance * 2))) { if (o.GetType().IsSubclassOf(typeof(UnitShip))) { UnitShip s = (UnitShip)o; if (!s.Dead && !s.IsAlly(this) && Vector2.Distance(Position.get(), o.Position.get()) < MaxEngagementDistance) { if (s.CanBeTargeted() && s.SnapBounce()) { s.ShieldDamage = s.ShieldToughness + 1; s.LastDamager = this; s.FreezeTime = 1000; s.StunState = AttackType.Melee; s.SetSpeed(Vector2.Normalize(s.Position.get() - Position.get()) * 16); } PulseSearchTime += (int)(StartingMaxSearchTime / 100f * (1.5f + s.UnitLevel)); Found = true; } } } if (Found) { SoundManager.Play3DSound("PulseTurretFire", new Vector3(Position.X(), Y, Position.Y()), 0.75f, 800, 2); Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y()); for (int i = 0; i < 30; i++) { ParticleManager.CreateParticle(Position3, Rand.V3() * MaxEngagementDistance / 1000f * 3, ParticleColor, 40, 5); } for (int i = 0; i < 2; i++) { FlareSystem.AddLightingPoint(Position3, new Vector3(0.3f), new Vector3(0, 0, 1), MaxEngagementDistance / 10, 40, 5, 10); ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 6, 5); ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 3, 4); } } } } } base.Update(gameTime); }