refactor: 着色器 & fix: 移动报错

This commit is contained in:
AncTe committed 2024-11-01 17:07:41 +08:00
1 parent 7bcd9ebeb2
commit 0989c82a6b
5 files changed
+922 -393

No files matched your search

+10 -6
View File
@@ -487,12 +487,16 @@ export class HeroMover extends ObjectMoverBase {
if (!adapter || !viewport) return;
await adapter.all('readyMove');
// 这里要检查前面那一格能不能走,不能走则不触发平滑视角,以避免撞墙上视角卡住
const { x, y } = core.status.hero.loc;
const firstDir = controller.queue.find(v => v.type === 'dir')?.value;
if (firstDir) {
const data = this.checkCanMove(x, y, toDir(firstDir as Dir));
if (data.canMove && !data.noPass) {
viewport.sync('startMove');
if (!this.ignoreTerrain) {
const { x, y } = core.status.hero.loc;
const firstDir = controller.queue.find(
v => v.type === 'dir'
)?.value;
if (firstDir && firstDir !== 'backward' && firstDir !== 'forward') {
const data = this.checkCanMove(x, y, toDir(firstDir as Dir));
if (data.canMove && !data.noPass) {
viewport.sync('startMove');
}
}
}
adapter.sync('startAnimate');