feat: dying and died events

This commit is contained in:
cha0s 2019-10-08 03:23:36 -05:00
parent ab37214926
commit 2b3fca9d9a

View File

@ -142,6 +142,7 @@ export class Alive extends decorate(Trait) {
if (this._dyingTickingPromise) {
return;
}
this.entity.emit('dying');
this.state.isDying = true;
this.entity._fastDirtyCheck = true;
this._fastDirtyCheck = true;
@ -149,6 +150,7 @@ export class Alive extends decorate(Trait) {
this._context
)
this._dyingTickingPromise.then(() => {
this.entity.emit('died');
this.entity.destroy();
});
},