|
23 | 23 | */ |
24 | 24 | Phaser.Events = function (sprite) { |
25 | 25 |
|
| 26 | + /** |
| 27 | + * @property {Phaser.Sprite} parent - The Sprite that owns these events. |
| 28 | + */ |
26 | 29 | this.parent = sprite; |
27 | 30 |
|
| 31 | + /** |
| 32 | + * @property {Phaser.Signal} onAddedToGroup - This signal is dispatched when the parent is added to a new Group. |
| 33 | + */ |
28 | 34 | this.onAddedToGroup = new Phaser.Signal(); |
| 35 | + |
| 36 | + /** |
| 37 | + * @property {Phaser.Signal} onRemovedFromGroup - This signal is dispatched when the parent is removed from a Group. |
| 38 | + */ |
29 | 39 | this.onRemovedFromGroup = new Phaser.Signal(); |
| 40 | + |
| 41 | + /** |
| 42 | + * @property {Phaser.Signal} onDestroy - This signal is dispatched when the parent is destoyed. |
| 43 | + */ |
| 44 | + this.onDestroy = new Phaser.Signal(); |
| 45 | + |
| 46 | + /** |
| 47 | + * @property {Phaser.Signal} onKilled - This signal is dispatched when the parent is killed. |
| 48 | + */ |
30 | 49 | this.onKilled = new Phaser.Signal(); |
| 50 | + |
| 51 | + /** |
| 52 | + * @property {Phaser.Signal} onRevived - This signal is dispatched when the parent is revived. |
| 53 | + */ |
31 | 54 | this.onRevived = new Phaser.Signal(); |
| 55 | + |
| 56 | + /** |
| 57 | + * @property {Phaser.Signal} onOutOfBounds - This signal is dispatched when the parent leaves the world bounds (only if Sprite.checkWorldBounds is true). |
| 58 | + */ |
32 | 59 | this.onOutOfBounds = new Phaser.Signal(); |
| 60 | + |
| 61 | + /** |
| 62 | + * @property {Phaser.Signal} onEnterBounds - This signal is dispatched when the parent returns within the world bounds (only if Sprite.checkWorldBounds is true). |
| 63 | + */ |
33 | 64 | this.onEnterBounds = new Phaser.Signal(); |
34 | 65 |
|
| 66 | + /** |
| 67 | + * @property {Phaser.Signal} onInputOver - This signal is dispatched if the parent is inputEnabled and receives an over event from a Pointer. |
| 68 | + * @default null |
| 69 | + */ |
35 | 70 | this.onInputOver = null; |
| 71 | + |
| 72 | + /** |
| 73 | + * @property {Phaser.Signal} onInputOut - This signal is dispatched if the parent is inputEnabled and receives an out event from a Pointer. |
| 74 | + * @default null |
| 75 | + */ |
36 | 76 | this.onInputOut = null; |
| 77 | + |
| 78 | + /** |
| 79 | + * @property {Phaser.Signal} onInputDown - This signal is dispatched if the parent is inputEnabled and receives a down event from a Pointer. |
| 80 | + * @default null |
| 81 | + */ |
37 | 82 | this.onInputDown = null; |
| 83 | + |
| 84 | + /** |
| 85 | + * @property {Phaser.Signal} onInputUp - This signal is dispatched if the parent is inputEnabled and receives an up event from a Pointer. |
| 86 | + * @default null |
| 87 | + */ |
38 | 88 | this.onInputUp = null; |
| 89 | + |
| 90 | + /** |
| 91 | + * @property {Phaser.Signal} onDragStart - This signal is dispatched if the parent is inputEnabled and receives a drag start event from a Pointer. |
| 92 | + * @default null |
| 93 | + */ |
39 | 94 | this.onDragStart = null; |
| 95 | + |
| 96 | + /** |
| 97 | + * @property {Phaser.Signal} onDragStop - This signal is dispatched if the parent is inputEnabled and receives a drag stop event from a Pointer. |
| 98 | + * @default null |
| 99 | + */ |
40 | 100 | this.onDragStop = null; |
41 | 101 |
|
| 102 | + /** |
| 103 | + * @property {Phaser.Signal} onAnimationStart - This signal is dispatched when the parent has an animation that is played. |
| 104 | + * @default null |
| 105 | + */ |
42 | 106 | this.onAnimationStart = null; |
| 107 | + |
| 108 | + /** |
| 109 | + * @property {Phaser.Signal} onAnimationComplete - This signal is dispatched when the parent has an animation that finishes playing. |
| 110 | + * @default null |
| 111 | + */ |
43 | 112 | this.onAnimationComplete = null; |
| 113 | + |
| 114 | + /** |
| 115 | + * @property {Phaser.Signal} onAnimationLoop - This signal is dispatched when the parent has an animation that loops playback. |
| 116 | + * @default null |
| 117 | + */ |
44 | 118 | this.onAnimationLoop = null; |
45 | 119 |
|
46 | 120 | }; |
47 | 121 |
|
48 | 122 | Phaser.Events.prototype = { |
49 | 123 |
|
| 124 | + /** |
| 125 | + * Removes all events. |
| 126 | + * |
| 127 | + * @method destroy |
| 128 | + */ |
50 | 129 | destroy: function () { |
51 | 130 |
|
52 | 131 | this.parent = null; |
| 132 | + |
| 133 | + this.onDestroy.dispose(); |
53 | 134 | this.onAddedToGroup.dispose(); |
54 | 135 | this.onRemovedFromGroup.dispose(); |
55 | 136 | this.onKilled.dispose(); |
|
0 commit comments