Animation no longer extends the EventEmitter

This commit is contained in:
Richard Davey 2020-09-08 12:17:18 +01:00
parent bbbae648b9
commit d476032e9f

View file

@ -6,7 +6,6 @@
var Clamp = require('../math/Clamp'); var Clamp = require('../math/Clamp');
var Class = require('../utils/Class'); var Class = require('../utils/Class');
var EventEmitter = require('eventemitter3');
var Events = require('./events'); var Events = require('./events');
var FindClosestInSorted = require('../utils/array/FindClosestInSorted'); var FindClosestInSorted = require('../utils/array/FindClosestInSorted');
var Frame = require('./AnimationFrame'); var Frame = require('./AnimationFrame');
@ -17,15 +16,19 @@ var SortByDigits = require('../utils/array/SortByDigits');
* @classdesc * @classdesc
* A Frame based Animation. * A Frame based Animation.
* *
* This consists of a key, some default values (like the frame rate) and a bunch of Frame objects. * Animations in Phaser consist of a sequence of `AnimationFrame` objects, which are managed by
* this class, along with properties that impact playback, such as the animations frame rate
* or delay.
* *
* The Animation Manager creates these. Game Objects don't own an instance of these directly. * This class contains all of the properties and methods needed to handle playback of the animation
* Game Objects have the Animation Component, which are like playheads to global Animations (these objects) * directly to an `AnimationState` instance, which is owned by a Sprite, or similar Game Object.
* So multiple Game Objects can have playheads all pointing to this one Animation instance. *
* You don't typically create an instance of this class directly, but instead go via
* either the `AnimationManager` or the `AnimationState` and use their `create` methods,
* depending on if you need a global animation, or local to a specific Sprite.
* *
* @class Animation * @class Animation
* @memberof Phaser.Animations * @memberof Phaser.Animations
* @extends Phaser.Events.EventEmitter
* @constructor * @constructor
* @since 3.0.0 * @since 3.0.0
* *
@ -35,14 +38,10 @@ var SortByDigits = require('../utils/array/SortByDigits');
*/ */
var Animation = new Class({ var Animation = new Class({
Extends: EventEmitter,
initialize: initialize:
function Animation (manager, key, config) function Animation (manager, key, config)
{ {
EventEmitter.call(this);
/** /**
* A reference to the global Animation Manager. * A reference to the global Animation Manager.
* *
@ -886,8 +885,6 @@ var Animation = new Class({
*/ */
destroy: function () destroy: function ()
{ {
this.removeAllListeners();
if (this.manager.off) if (this.manager.off)
{ {
this.manager.off(Events.PAUSE_ALL, this.pause, this); this.manager.off(Events.PAUSE_ALL, this.pause, this);