public override void Update(GameTime gameTime) { SoundInstance = SoundManager.PlayLoopingSound(SoundInstance, "MiningRingHum", new Vector3(Position.X(), Y, Position.Y()), 0.05f, 400, 2); RotationOffsetSpeed = new Vector3(0.001f, 0.005f, 0.0025f); //RotationOffset += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * 0.1f; Size.set(new Vector2(110)); ShutDownTime = 0; DrawRotation = Logic.Clerp(DrawRotation, TargetDrawRotation, 0.1f * gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f); DamageTime -= gameTime.ElapsedGameTime.Milliseconds; SizeMult += SizeMultAcceleration * gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f / 6; SizeMultAcceleration -= SizeMultGravity * gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * 3; if (SizeMult < MinSizeMult) { SizeMult = MinSizeMult; if (DamageTime > 0) { SizeMultAcceleration = SizeMultBounce; } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (!Dead) { SoundInstance = SoundManager.PlayLoopingSound(SoundInstance, "SignalTowerHum", new Vector3(Position.X(), Y, Position.Y()), 0.05f, 400, 2); } else { SoundInstance.Volume = 0; } base.Update(gameTime); }
public override void Update(GameTime gameTime) { SoundInstance = SoundManager.PlayLoopingSound(SoundInstance, "FieldHum", new Vector3(Position.X(), Y, Position.Y()), 0.05f, 800, 2); /* * if (Parent2DScene.WorldViewerChildren.Count != ActiveSounds.Count) * { * SoundManager.Play3DSound("FieldCast", new Vector3(Position.X(), Y, Position.Y()), Vector3.Zero, 1, false); * * foreach (SoundManager.ActiveSound a in ActiveSounds) * a.Instance.Stop(); * * SoundManager.Play3DSound("MiningRingHum", new Vector3(Position.X(), Y, Position.Y()), Vector3.Zero, 0.25f, true); * ActiveSounds.Clear(); * * for (int i = 0; i < Parent2DScene.WorldViewerChildren.Count; i++) * ActiveSounds.AddLast(SoundManager.ActiveSounds[SoundManager.ActiveSoundCount - (i + 1)]); * } */ for (int i = 0; i < CircleGlows; i++) { float R = (float)(((float)i / CircleGlows * 2 * Math.PI) + (Level.Time % 2 / 2f * Math.PI) / 2); Vector3 P = new Vector3((float)Math.Cos(R) * Size.X() + Position.X(), 0, (float)Math.Sin(R) * Size.X() + Position.Y()); ParticleManager.CreateParticle(P, Vector3.Zero, CircleColor * Alpha, 64, 0); } TimeAlive += gameTime.ElapsedGameTime.Milliseconds; if (TimeAlive > LifeTime) { Alpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChangeRate; if (Alpha < 0) { Destroy(); } } else { TargetSize -= Vector2.One * 0.25f * gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f; Size.setNoPerform(Size.get() + Vector2.One * 4 * gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f); if (Size.X() > TargetSize.X) { Size.setNoPerform(TargetSize); } if (Alpha < 1) { Alpha += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChangeRate; if (Alpha > 1) { Alpha = 1; } } SearchTime += gameTime.ElapsedGameTime.Milliseconds; if (SearchTime > MaxSearchTime) { SearchTime -= MaxSearchTime; QuadGrid quad = Parent2DScene.quadGrids.First.Value; foreach (Basic2DObject o in quad.Enumerate(Position.get(), Size.get())) { if ((o.GetType().IsSubclassOf(typeof(UnitShip)) || o.GetType().IsSubclassOf(typeof(PlayerShip))) && Vector2.Distance(o.Position.get(), Position.get()) < Size.X()) { UnitBasic u = (UnitBasic)o; if (u.GetTeam() != WaveManager.ActiveTeam) { EffectUnit((UnitBasic)o, gameTime); } } } } } base.Update(gameTime); }
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); }