public override void Removed(EventArgs e) { base.Removed(e); if (starParticles != null && children.Contains(starParticles)) { RemoveChild(starParticles); } starParticles = null; if (steamParticles != null && children.Contains(steamParticles)) { RemoveChild(steamParticles); } steamParticles = null; if (spacePsst != null) { spacePsst.Stop(AudioStopOptions.Immediate); spacePsst = null; } }
public override void Update(Microsoft.Xna.Framework.GameTime gameTime) { base.Update(gameTime); if (screen.isActive && steamParticles != null) { if (steamParticles.isComplete) { steamParticles = null; } } else if (screen.isActive && starParticles != null) { if (starParticles.isComplete) { starParticles = null; } else { int msDelay = 15; prevMs += gameTime.ElapsedGameTime.Milliseconds; if (prevMs > msDelay) { prevMs -= msDelay; int pi = (int)Math.Min(roundScore / (laneCount - 1f), 7); //starParticles.CreateInstanceAt("plpart" + pi, "pe", X + rnd.Next(40) - 20, Y + rnd.Next(40) - 20, 0, 0); starParticles.CreateInstanceAt("plpart7", "pe", X + rnd.Next(40) - 20, Y + rnd.Next(40) - 20, 0, 0); starParticles.SetParticleScale(pi / ((laneCount - 1f) * 3f) + .33f); } } } else { this.SpeedLevel = SpeedLevel.Normal; } }