Skip to content

Commit 2976f96

Browse files
committed
When dying after collecting mini heart, make music resume after respawn
1 parent 323e6ae commit 2976f96

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Entities/MiniHeart.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)