fix pathfinding issues

This commit is contained in:
2025-01-12 19:43:45 +09:00
parent 6ff950640c
commit 8e861929cb
6 changed files with 385 additions and 158 deletions
+7
View File
@@ -11,17 +11,20 @@ export default class Game {
running = false
nextTick = 0
#logic = null
#entities = []
#eventEmitter = new EventEmitter()
#projectiles = []
#terrains = []
#tickBudget = 1000 / this.tickRate
get logic() { return this.#logic }
get entities() { return this.#entities }
get eventEmitter() { return this.#eventEmitter }
get projectiles() { return this.#projectiles }
get terrains() { return this.#terrains }
get tickBudget() { return this.#tickBudget }
set logic(value) { this.#logic = value }
get unadjustedWaypoints() {
return this.terrains.map((t) => t.unadjustedWaypoints).concat(this.entities.map((e) => e.unadjustedWaypoints)).flat()
@@ -104,6 +107,10 @@ export default class Game {
update() {
this.#entities.forEach((e) => e.update())
this.#projectiles.forEach((p) => p.update())
if (this.#logic != null) {
this.#logic()
}
this.currentTick++
this.eventEmitter.emit('tick')
}