File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -821,21 +821,25 @@ var GameObject = new Class({
821
821
* @method Phaser.GameObjects.GameObject#destroy
822
822
* @fires Phaser.GameObjects.Events#DESTROY
823
823
* @since 3.0.0
824
+ *
825
+ * @param {boolean } fromScene - True if this Game Object is destroyed from scene, false if not.
824
826
*/
825
- destroy : function ( )
827
+ destroy : function ( fromScene )
826
828
{
827
829
// This Game Object has already been destroyed
828
830
if ( ! this . scene || this . ignoreDestroy )
829
831
{
830
832
return ;
831
833
}
832
834
835
+ if ( fromScene === undefined ) { fromScene = false ; }
836
+
833
837
if ( this . preDestroy )
834
838
{
835
839
this . preDestroy . call ( this ) ;
836
840
}
837
841
838
- this . emit ( Events . DESTROY , this ) ;
842
+ this . emit ( Events . DESTROY , this , fromScene ) ;
839
843
840
844
this . removeAllListeners ( ) ;
841
845
Original file line number Diff line number Diff line change 15
15
* @since 3.0.0
16
16
*
17
17
* @param {Phaser.GameObjects.GameObject } gameObject - The Game Object which is being destroyed.
18
+ * @param {boolean } fromScene - True if this Game Object is destroyed from scene, false if not.
18
19
*/
19
20
module . exports = 'destroy' ;
You can’t perform that action at this time.
0 commit comments