File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -140,22 +140,16 @@ export function make<T>(comps: CompList<T> = []): GameObj<T> {
140
140
} ,
141
141
142
142
remove ( obj : GameObj ) : void {
143
- const idx = this . children . indexOf ( obj ) ;
144
-
145
- if ( idx !== - 1 ) {
146
- obj . parent = null ;
147
- this . children . splice ( idx , 1 ) ;
143
+ obj . parent = null ;
148
144
149
- const trigger = ( o : GameObj ) => {
150
- o . trigger ( "destroy" ) ;
151
- _k . game . events . trigger ( "destroy" , o ) ;
152
- o . children . forEach ( ( child ) => trigger ( child ) ) ;
153
- } ;
145
+ const trigger = ( o : GameObj ) => {
146
+ o . trigger ( "destroy" ) ;
147
+ _k . game . events . trigger ( "destroy" , o ) ;
148
+ o . children . forEach ( ( child ) => trigger ( child ) ) ;
149
+ } ;
154
150
155
- trigger ( obj ) ;
156
- }
151
+ trigger ( obj ) ;
157
152
} ,
158
-
159
153
// TODO: recursive
160
154
removeAll ( this : GameObj , tag ?: Tag ) {
161
155
if ( tag ) {
You can’t perform that action at this time.
0 commit comments