99
1010namespace Celeste . Mod . SpringCollab2020 . Entities {
1111 [ CustomEntity ( "SpringCollab2020/SpikeJumpThroughController" ) ]
12+ [ Tracked ]
1213 class SpikeJumpThroughController : Entity {
1314 private static bool SpikeHooked ;
14- private static SpikeJumpThroughController CurrentController ;
15- private static SpikeJumpThroughController NextController ;
16- private static float TransitionProgress = - 1f ;
1715
1816 public SpikeJumpThroughController ( EntityData data , Vector2 offset ) : this ( data . Bool ( "persistent" , false ) , offset ) { }
1917
2018 public SpikeJumpThroughController ( bool persistent , Vector2 offset ) : base ( offset ) {
2119 SpringCollab2020Module . Instance . Session . SpikeJumpThroughHooked = persistent ;
2220
23- Add ( new TransitionListener {
24- OnIn = progress => TransitionProgress = progress ,
25- OnOut = progress => TransitionProgress = progress ,
26- OnInBegin = ( ) => TransitionProgress = 0f ,
27- OnInEnd = ( ) => TransitionProgress = - 1f
28- } ) ;
29-
30- Logger . Log ( "s" , SpringCollab2020Module . Instance . Session . SpikeJumpThroughHooked . ToString ( ) ) ;
31-
3221 }
3322
3423 public static void Load ( ) {
@@ -39,18 +28,9 @@ public static void Unload() {
3928 On . Celeste . Level . LoadLevel -= OnLoadLevelHook ;
4029 }
4130
42- public override void Update ( ) {
43- base . Update ( ) ;
44- if ( TransitionProgress == - 1f && CurrentController == null ) {
45- CurrentController = this ;
46- NextController = null ;
47- }
48- }
49-
5031 public override void Awake ( Scene scene ) {
5132 base . Awake ( scene ) ;
5233
53- NextController = this ;
5434 if ( ! SpikeHooked ) {
5535 On . Celeste . Spikes . OnCollide += OnCollideHook ;
5636 SpikeHooked = true ;
@@ -60,12 +40,7 @@ public override void Awake(Scene scene) {
6040 public override void Removed ( Scene scene ) {
6141 base . Removed ( scene ) ;
6242
63- CurrentController = NextController ;
64- NextController = null ;
65-
66- TransitionProgress = - 1f ;
67-
68- if ( SpikeHooked && CurrentController == null ) {
43+ if ( SpikeHooked && scene . Tracker . CountEntities < SpikeJumpThroughController > ( ) <= 1 ) {
6944 On . Celeste . Spikes . OnCollide -= OnCollideHook ;
7045 SpikeHooked = false ;
7146 }
@@ -74,7 +49,6 @@ public override void Removed(Scene scene) {
7449 public override void SceneEnd ( Scene scene ) {
7550 base . SceneEnd ( scene ) ;
7651
77- CurrentController = NextController = null ;
7852 if ( SpikeHooked ) {
7953 On . Celeste . Spikes . OnCollide -= OnCollideHook ;
8054 SpikeHooked = false ;
0 commit comments