chore: clean stuff up

This commit is contained in:
cha0s 2019-05-03 01:22:26 -05:00
parent 0710ff875d
commit c1a90b941b
3 changed files with 6 additions and 0 deletions

View File

@ -239,6 +239,7 @@ export class Entity extends decorate(Resource) {
for (const eventName in listeners) {
this.off(eventName, listeners[eventName]);
}
instance._memoizedListeners = {};
// Remove state.
this.state = this.state.delete(type);
// Remove instance.

View File

@ -39,6 +39,7 @@ export class Pictured extends decorate(Trait) {
sprite.image.destroy();
sprite.destroy();
}
this.sprites = undefined;
}
}

View File

@ -45,11 +45,15 @@ class AnimatedBase extends Trait {
const animationView = this.animationViews[key];
animationView.destroy();
}
this.animationViews = undefined;
}
for (const key in this.animations) {
const animation = this.animations[key];
animation.destroy();
}
this.animations = {};
this.animationsPromise = undefined;
this._cachedAabbs = {};
}
hideAnimation(key) {