-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-controller.js
More file actions
25 lines (18 loc) · 640 Bytes
/
data-controller.js
File metadata and controls
25 lines (18 loc) · 640 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import behaviorObjects from '../behaviors/*.js'
import gameData from '../data/data.json'
export class DataController {
constructor(scene) {
this.gameData = gameData
this.scene = scene
this.enemies = this.gameData.sheets.find(sheet => sheet.name === 'enemies').lines
}
createBehaviors(actor, actorKey) {
const enemyData = this.enemies.find(enemy => enemy.name === actorKey)
return enemyData.behaviors.map((behavior) => {
const newBehavior = new behaviorObjects[behavior.behavior].default(actor)
newBehavior.initialize(behavior.data)
return newBehavior
})
}
update(time, delta) {}
}