// This method updates all the wells in the game. public void UpdateWells() { foreach (Well well in StableWells.ToList()) { well.TicksLeft--; if (well.TicksLeft == 0) { int objIndex = StableWells.FindIndex(item => item.Equals(well)); UpdateAnimationEvent(this, new AnimationEventArgs(false, AnimationType.Stable, objIndex, 12, 0)); well.TicksLeft = 3000; well.IsStable = false; well.Strength = 900; UnstableWells.Add(well); UpdateAnimationEvent(this, new AnimationEventArgs(false, AnimationType.Unstable, UnstableWells.Count, 0, 0)); StableWells.Remove(well); GameInvokeSoundEvent(this, SoundEffect.Destabilize); } } foreach (Well well in UnstableWells.ToList()) { well.TicksLeft--; if (well.TicksLeft % 100 == 0) { if (well.ShockWave.TicksLeft == 0) { well.ShockWave.TicksLeft = 80; } } if (well.ShockWave == null) { well.ShockWave = new Shockwave(this, well); } well.ShockWave.Pulse(); if (well.TicksLeft == 0) { int objIndex = UnstableWells.FindIndex(item => item.Equals(well)); UpdateAnimationEvent(this, new AnimationEventArgs(false, AnimationType.Unstable, objIndex, 24, 0)); GameInvokeSoundEvent(this, SoundEffect.Collapse); UnstableWells.Remove(well); GameObjects.Remove(well); } } }
// This method updates all the wells in the game. public void UpdateWells() { foreach (Well well in StableWells.ToList()) { well.TicksLeft--; if (well.TicksLeft == 0) { well.TicksLeft = 3000; well.IsStable = false; well.Strength = 900; UnstableWells.Add(well); StableWells.Remove(well); } } foreach (Well well in UnstableWells.ToList()) { if (well.TicksLeft == 0) { // any explosions or something???? UnstableWells.Remove(well); GameObjects.Remove(well); } } }