mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 12:49:25 +08:00
fix: 大地图边缘瞬移时视角延时
This commit is contained in:
parent
f1b20450aa
commit
0d498a9437
@ -193,8 +193,13 @@ export class FloorViewport implements ILayerGroupRenderExtends {
|
||||
|
||||
if (!this.hero.renderable) return;
|
||||
|
||||
this.nx = this.hero.renderable.x;
|
||||
this.ny = this.hero.renderable.y;
|
||||
const { x, y } = this.hero.renderable;
|
||||
const { x: nx, y: ny } = this.getBoundedPosition(
|
||||
x + this.ox,
|
||||
y + this.oy
|
||||
);
|
||||
this.nx = nx;
|
||||
this.ny = ny;
|
||||
|
||||
if (ending) {
|
||||
if (this.ox === xTarget && this.oy == yTarget) {
|
||||
@ -272,27 +277,18 @@ export class FloorViewport implements ILayerGroupRenderExtends {
|
||||
private create() {
|
||||
let nx = this.nx;
|
||||
let ny = this.ny;
|
||||
let ox = this.ox;
|
||||
let oy = this.oy;
|
||||
const halfWidth = core._PX_ / 2;
|
||||
const halfHeight = core._PY_ / 2;
|
||||
this.delegation = this.group.delegateTicker(() => {
|
||||
if (!this.enabled) return;
|
||||
if (
|
||||
this.nx === nx &&
|
||||
this.ny === ny &&
|
||||
this.ox === ox &&
|
||||
this.oy === oy
|
||||
) {
|
||||
if (this.nx === nx && this.ny === ny) {
|
||||
return;
|
||||
}
|
||||
const cell = this.group.cellSize;
|
||||
const half = cell / 2;
|
||||
nx = this.nx;
|
||||
ny = this.ny;
|
||||
ox = this.ox;
|
||||
oy = this.oy;
|
||||
const { x: bx, y: by } = this.getBoundedPosition(nx + ox, ny + oy);
|
||||
const { x: bx, y: by } = this.getBoundedPosition(nx, ny);
|
||||
const rx = bx * cell - halfWidth + half;
|
||||
const ry = by * cell - halfHeight + half;
|
||||
core.bigmap.offsetX = rx;
|
||||
|
Loading…
Reference in New Issue
Block a user