@@ -22,7 +22,7 @@ public class BoomBox : Solid {
22
22
SpeedMax = 24f
23
23
} ;
24
24
25
- protected Circle _boomCollider ;
25
+ protected readonly BoomCollider _boomCollider ;
26
26
27
27
private readonly float _initialDelay ;
28
28
private readonly Sprite _sprite ;
@@ -36,7 +36,7 @@ public class BoomBox : Solid {
36
36
private Coroutine _sequence ;
37
37
private bool _steamAnger = false ;
38
38
39
- public BoomBox ( Vector2 position , string activationId , float initialDelay , bool startActive )
39
+ public BoomBox ( Vector2 position , string activationId , float initialDelay , bool startActive )
40
40
: base ( position , 24 , 24 , false ) {
41
41
Add ( Activator = new FactoryActivator ( ) ) ;
42
42
Activator . StartOn = startActive ;
@@ -64,7 +64,7 @@ public BoomBox(Vector2 position, string activationId, float initialDelay, bool s
64
64
_boomSprite . CenterOrigin ( ) ;
65
65
_boomSprite . Position = new Vector2 ( Width / 2 , Height / 2 ) ;
66
66
67
- _boomCollider = new Circle ( 40f , X + Width / 2 , Y + Height / 2 ) ;
67
+ _boomCollider = new BoomCollider ( position + new Vector2 ( Width / 2 , Height / 2 ) ) ;
68
68
Add ( _sfx = new SoundSource ( ) ) ;
69
69
_sfx . Position = new Vector2 ( Width / 2 , Height / 2 ) ;
70
70
Add ( new LightOcclude ( 0.2f ) ) ;
@@ -146,6 +146,7 @@ private IEnumerator WindDownSequence() {
146
146
147
147
public override void Added ( Scene scene ) {
148
148
base . Added ( scene ) ;
149
+ scene . Add ( _boomCollider ) ;
149
150
Activator . HandleStartup ( scene ) ;
150
151
}
151
152
@@ -172,13 +173,6 @@ public override void Update() {
172
173
}
173
174
}
174
175
175
- public override void DebugRender ( Camera camera ) {
176
- base . DebugRender ( camera ) ;
177
- if ( Activator . IsOn ) {
178
- _boomCollider . Render ( camera , Color . HotPink ) ;
179
- }
180
- }
181
-
182
176
private void HandleAngryMode ( ) {
183
177
CheckForAngryMode ( ) ;
184
178
if ( _angryMode ) {
@@ -223,7 +217,7 @@ private void Explode() {
223
217
( Scene as Level ) . Displacement . AddBurst ( Center , 0.35f , 4f , 64f , 0.5f ) ;
224
218
Player player = Scene . Tracker . GetEntity < Player > ( ) ;
225
219
Collidable = false ;
226
- if ( player != null && _boomCollider . Collide ( player ) && ! Scene . CollideCheck < Solid > ( player . Center , Center ) ) {
220
+ if ( player != null && player . CollideCheck ( _boomCollider ) && ! Scene . CollideCheck < Solid > ( player . Center , Center ) ) {
227
221
if ( player . Bottom < Top && player . Top > Bottom ) {
228
222
player . ExplodeLaunch ( Center , false , true ) ;
229
223
} else {
@@ -233,5 +227,11 @@ private void Explode() {
233
227
234
228
Collidable = true ;
235
229
}
230
+
231
+ protected class BoomCollider : Entity {
232
+ public BoomCollider ( Vector2 position ) : base ( position ) {
233
+ Collider = new Circle ( 40f , 0 , 0 ) ;
234
+ }
235
+ }
236
236
}
237
237
}
0 commit comments