From 5616f3275b661d09779254fe977796245f969ae3 Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 27 Mar 2019 01:03:05 -0500 Subject: [PATCH] feat: layered and roomed --- packages/entity/traits/layered.js | 24 ++++++++++++++++++++++++ packages/entity/traits/roomed.js | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 packages/entity/traits/layered.js create mode 100644 packages/entity/traits/roomed.js diff --git a/packages/entity/traits/layered.js b/packages/entity/traits/layered.js new file mode 100644 index 0000000..0609f8d --- /dev/null +++ b/packages/entity/traits/layered.js @@ -0,0 +1,24 @@ +import {Trait} from '@avocado/entity'; + +export class Layered extends Trait { + + initialize() { + this._layer = undefined; + } + + destroy() { + delete this._layer; + this.entity.emit('removedFromLayer'); + } + + get layer() { + return this._layer; + } + + set layer(layer) { + this._layer = layer; + this.entity.emit('addedToLayer'); + } + +} + diff --git a/packages/entity/traits/roomed.js b/packages/entity/traits/roomed.js new file mode 100644 index 0000000..2f7d546 --- /dev/null +++ b/packages/entity/traits/roomed.js @@ -0,0 +1,23 @@ +import {Trait} from '@avocado/entity'; + +export class Roomed extends Trait { + + initialize() { + this._room = undefined; + } + + destroy() { + delete this._room; + this.entity.emit('removedFromRoom'); + } + + get room() { + return this._room; + } + + set room(room) { + this._room = room; + this.entity.emit('addedToRoom'); + } + +}