File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -14,14 +14,16 @@ namespace Celeste.Mod.CollabUtils2.Entities {
1414 public class MiniHeart : AbstractMiniHeart {
1515 private Sprite white ;
1616 private bool inCollectAnimation = false ;
17+
18+ private Coroutine smashRoutine ;
1719 private EventInstance pauseMusicSnapshot ;
1820 private SoundEmitter collectSound ;
1921
2022 public MiniHeart ( EntityData data , Vector2 position , EntityID gid )
2123 : base ( data , position , gid ) { }
2224
2325 protected override void heartBroken ( Player player , Holdable holdable , Level level ) {
24- Add ( new Coroutine ( SmashRoutine ( player , level ) ) ) ;
26+ Add ( smashRoutine = new Coroutine ( SmashRoutine ( player , level ) ) ) ;
2527 }
2628
2729 private IEnumerator SmashRoutine ( Player player , Level level ) {
@@ -145,8 +147,17 @@ private void interruptCollection() {
145147 collectSound = null ;
146148 }
147149
150+ if ( smashRoutine != null ) {
151+ smashRoutine . RemoveSelf ( ) ;
152+ smashRoutine = null ;
153+ }
154+ }
155+
156+ public override void Removed ( Scene scene ) {
157+ base . Removed ( scene ) ;
158+
159+ // resume music when the player respawns.
148160 resumeMusic ( ) ;
149- RemoveSelf ( ) ;
150161 }
151162
152163 public override void SceneEnd ( Scene scene ) {
You can’t perform that action at this time.
0 commit comments