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;
|
if (!this.hero.renderable) return;
|
||||||
|
|
||||||
this.nx = this.hero.renderable.x;
|
const { x, y } = this.hero.renderable;
|
||||||
this.ny = this.hero.renderable.y;
|
const { x: nx, y: ny } = this.getBoundedPosition(
|
||||||
|
x + this.ox,
|
||||||
|
y + this.oy
|
||||||
|
);
|
||||||
|
this.nx = nx;
|
||||||
|
this.ny = ny;
|
||||||
|
|
||||||
if (ending) {
|
if (ending) {
|
||||||
if (this.ox === xTarget && this.oy == yTarget) {
|
if (this.ox === xTarget && this.oy == yTarget) {
|
||||||
@ -272,27 +277,18 @@ export class FloorViewport implements ILayerGroupRenderExtends {
|
|||||||
private create() {
|
private create() {
|
||||||
let nx = this.nx;
|
let nx = this.nx;
|
||||||
let ny = this.ny;
|
let ny = this.ny;
|
||||||
let ox = this.ox;
|
|
||||||
let oy = this.oy;
|
|
||||||
const halfWidth = core._PX_ / 2;
|
const halfWidth = core._PX_ / 2;
|
||||||
const halfHeight = core._PY_ / 2;
|
const halfHeight = core._PY_ / 2;
|
||||||
this.delegation = this.group.delegateTicker(() => {
|
this.delegation = this.group.delegateTicker(() => {
|
||||||
if (!this.enabled) return;
|
if (!this.enabled) return;
|
||||||
if (
|
if (this.nx === nx && this.ny === ny) {
|
||||||
this.nx === nx &&
|
|
||||||
this.ny === ny &&
|
|
||||||
this.ox === ox &&
|
|
||||||
this.oy === oy
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cell = this.group.cellSize;
|
const cell = this.group.cellSize;
|
||||||
const half = cell / 2;
|
const half = cell / 2;
|
||||||
nx = this.nx;
|
nx = this.nx;
|
||||||
ny = this.ny;
|
ny = this.ny;
|
||||||
ox = this.ox;
|
const { x: bx, y: by } = this.getBoundedPosition(nx, ny);
|
||||||
oy = this.oy;
|
|
||||||
const { x: bx, y: by } = this.getBoundedPosition(nx + ox, ny + oy);
|
|
||||||
const rx = bx * cell - halfWidth + half;
|
const rx = bx * cell - halfWidth + half;
|
||||||
const ry = by * cell - halfHeight + half;
|
const ry = by * cell - halfHeight + half;
|
||||||
core.bigmap.offsetX = rx;
|
core.bigmap.offsetX = rx;
|
||||||
|
Loading…
Reference in New Issue
Block a user