public static KeyValuePair <uint, SoundEffectInstance> KillTrackedSound(KeyValuePair <uint, SoundEffectInstance> soundInfo) { ActiveSound sound = Main.GetActiveSound(new SlotId(soundInfo.Key)); if (sound != null) { sound.Stop(); } if (soundInfo.Value != null) { soundInfo.Value.Stop(); } return(new KeyValuePair <uint, SoundEffectInstance>(InvalidSlot, null)); }
public void GivenTheListContainsACompletedItemDoesUpdateDropThatItem() { var ass = new ActiveSoundService(); var sei = new DummySoundEffectInstance(); var activeSound = new ActiveSound(sei); ass.Add(activeSound); Assert.AreEqual(1, ass.Count); var item = ass[0]; Assert.AreEqual(SoundState.Playing, item.SoundEffectInstance.State); activeSound.Stop(); ass.Update(); Assert.AreEqual(ass.Count, 0); }
public override void AI() { Lighting.AddLight(projectile.Center, 0f, .7f, 0f); ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(projectile.localAI[0])); if (activeSound != null) { if (activeSound.Volume == 0f) { activeSound.Stop(); projectile.localAI[0] = SlotId.Invalid.ToFloat(); } activeSound.Volume = Math.Max(0f, activeSound.Volume - 0.05f); } else { projectile.localAI[0] = SlotId.Invalid.ToFloat(); } if (projectile.ai[1] == 1f) { if (projectile.alpha < 255) { projectile.alpha += 51; } if (projectile.alpha >= 255) { projectile.alpha = 255; projectile.Kill(); return; } } else { if (projectile.alpha > 0) { projectile.alpha -= 50; } if (projectile.alpha < 0) { projectile.alpha = 0; } } float num726 = 30f; float num727 = num726 * 4f; projectile.ai[0] += 1f; if (projectile.ai[0] > num727) { projectile.ai[0] = 0f; } Vector2 vector62 = -Vector2.UnitY.RotatedBy(6.28318548f * projectile.ai[0] / num726, default); float val = 0.75f + vector62.Y * 0.25f; float val2 = 0.8f - vector62.Y * 0.2f; float num728 = Math.Max(val, val2); projectile.position += new Vector2(projectile.width, projectile.height) / 2f; projectile.width = (projectile.height = (int)(80f * num728)); projectile.position -= new Vector2(projectile.width, projectile.height) / 2f; projectile.frameCounter++; if (projectile.frameCounter >= 3) { projectile.frameCounter = 0; projectile.frame++; if (projectile.frame >= 4) { projectile.frame = 0; } } for (int num729 = 0; num729 < 1; num729++) { float num730 = 55f * num728; float num731 = 11f * num728; float num732 = 0.5f; int num733 = Dust.NewDust(projectile.position, projectile.width, projectile.height, ModContent.DustType <Dusts.StarDust>(), 0f, 0f, 100, default, 0.5f);