avocado-old/packages/behavior/item/routine.js
2019-05-05 04:26:35 -05:00

39 lines
568 B
JavaScript

import {Actions} from './actions';
export class Routine {
static type() {
return 'routine';
}
constructor() {
this._context = undefined;
this.actions = new Actions();
}
set context(context) {
this._context = context;
}
clone(other) {
this.actions = other.actions.clone();
}
fromJSON(json) {
this.actions.fromJSON(json.routine);
return this;
}
tick(elapsed) {
this.actions.tick(this._context, elapsed);
}
toJSON() {
return {
type: 'routine',
actions: this.actions.toJSON(),
}
}
}