public virtual void Relocate() { IsRelocating = true; RelocationPosition = Position.get() + Rand.NV2() * 300; }
public override void Update(GameTime gameTime) { SoundInstance = SoundManager.PlayLoopingSound(SoundInstance, "SlowFieldHum", new Vector3(Position.X(), Y, Position.Y()), 0.03f, MaxEngagementDistance + 200, 2); Size.set(new Vector2(SlowFieldCard.STurretSize - 5 + 10 * Rand.F())); Vector2 ProjectedPosition = Position.get() + Rand.NV2() * MaxEngagementDistance; Vector3 Position3 = new Vector3(ProjectedPosition.X, Y, ProjectedPosition.Y); ParticleManager.CreateParticle(Position3, Rand.V3() * Size.X() * 2, ParticleColor, 40, 5); if (!Dead) { SearchTime += gameTime.ElapsedGameTime.Milliseconds; if (SearchTime > MaxSearchTime) { bool CanEmp = true; SearchTime -= MaxSearchTime; QuadGrid quad = Parent2DScene.quadGrids.First.Value; foreach (Basic2DObject o in quad.Enumerate(Position.get(), new Vector2(MaxEngagementDistance * 2))) { if (o.GetType().IsSubclassOf(typeof(UnitBasic))) { UnitBasic s = (UnitBasic)o; if (!s.Dead && !s.IsAlly(this) && Vector2.Distance(Position.get(), o.Position.get()) < MaxEngagementDistance - o.Size.X()) { if (s.GetType().IsSubclassOf(typeof(UnitShip))) { UnitShip s2 = (UnitShip)s; if (!s2.Slowed) { s2.Slowed = true; s2.Acceleration /= 2; if (s.Weakness == AttackType.Blue) { s2.Acceleration /= 2; if (CanEmp) { CanEmp = false; s2.EMP(this, IsUpdgraded ? 1 : 0); if (s2.TestTag(UnitTag.Monster)) { SearchTime -= MaxSearchTime / 5; } } } s2.MaxEngagementDistance /= 1.5f; s2.MinEngagementDistance /= 1.5f; } } } } } } } base.Update(gameTime); }