新增IUpdatable接口 用于减少update所带来的的性能损耗

This commit is contained in:
yhh
2020-07-10 11:24:42 +08:00
parent 877fc4c9bf
commit f6c2d81a83
14 changed files with 238 additions and 79 deletions

View File

@@ -73,14 +73,15 @@ class MainScene extends Scene {
}
public astarTest() {
let graph = new AstarGridGraph(20, 20);
let graph = new AstarGridGraph(30, 30);
graph.weightedNodes.push(new Vector2(3, 3));
graph.weightedNodes.push(new Vector2(3, 4));
graph.weightedNodes.push(new Vector2(4, 3));
graph.weightedNodes.push(new Vector2(4, 4));
// graph.weightedNodes.push(new Vector2(3, 3));
// graph.weightedNodes.push(new Vector2(3, 4));
// graph.weightedNodes.push(new Vector2(4, 3));
// graph.weightedNodes.push(new Vector2(4, 4));
let path = graph.search(new Vector2(3, 4), new Vector2(15, 17));
console.log(path);
let startTime = egret.getTimer();
let path = graph.search(new Vector2(1, 1), new Vector2(29, 29));
console.log(egret.getTimer() - startTime);
}
}