feat: layer state

This commit is contained in:
cha0s 2019-03-26 17:04:44 -05:00
parent da1ae31f44
commit 90a5bed2a8

View File

@ -1,3 +1,6 @@
import * as I from 'immutable';
import {EntityList} from '@avocado/entity';
import {Tiles} from '@avocado/topdown';
export class Layer {
@ -5,7 +8,8 @@ export class Layer {
constructor() {
this.tiles = undefined;
this.tilesetUri = undefined;
this.entityList = undefined;
this.entityList = new EntityList();
this._state = I.Map();
}
fromJSON(json) {
@ -18,4 +22,15 @@ export class Layer {
return this;
}
get state() {
return this._state;
}
tick(elapsed) {
if (this.entityList) {
this.entityList.tick(elapsed);
this._state = this._state.set('entityList', this.entityList.state);
}
}
}