mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-06-09 00:38:00 +08:00
feat: 暂时删除非瞬移的平滑视角
This commit is contained in:
parent
57ebcb4461
commit
ebcc0bcfe5
@ -159,7 +159,7 @@ export class FloorViewport implements ILayerGroupRenderExtends {
|
|||||||
let yStartTime: number = Date.now();
|
let yStartTime: number = Date.now();
|
||||||
let ending: boolean = false;
|
let ending: boolean = false;
|
||||||
// 这个数等于 sinh(2),用这个数的话,可以正好在刚开始移动的时候达到1的斜率,效果会比较好
|
// 这个数等于 sinh(2),用这个数的话,可以正好在刚开始移动的时候达到1的斜率,效果会比较好
|
||||||
const transitionTime = this.hero.speed * 3.626860407847019;
|
let transitionTime = this.hero.speed * 3.626860407847019;
|
||||||
|
|
||||||
const setTargetX = (x: number, time: number) => {
|
const setTargetX = (x: number, time: number) => {
|
||||||
if (x === xTarget) return;
|
if (x === xTarget) return;
|
||||||
@ -178,6 +178,7 @@ export class FloorViewport implements ILayerGroupRenderExtends {
|
|||||||
this.hero.off('moveTick', this.movingFramer);
|
this.hero.off('moveTick', this.movingFramer);
|
||||||
}
|
}
|
||||||
this.movingFramer = () => {
|
this.movingFramer = () => {
|
||||||
|
if (this.inTransition) return;
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
if (!this.inMoving && !ending) {
|
if (!this.inMoving && !ending) {
|
||||||
setTargetX(0, now);
|
setTargetX(0, now);
|
||||||
@ -194,10 +195,7 @@ export class FloorViewport implements ILayerGroupRenderExtends {
|
|||||||
if (!this.hero.renderable) return;
|
if (!this.hero.renderable) return;
|
||||||
|
|
||||||
const { x, y } = this.hero.renderable;
|
const { x, y } = this.hero.renderable;
|
||||||
const { x: nx, y: ny } = this.getBoundedPosition(
|
const { x: nx, y: ny } = this.getBoundedPosition(x, y);
|
||||||
x + this.ox,
|
|
||||||
y + this.oy
|
|
||||||
);
|
|
||||||
this.nx = nx;
|
this.nx = nx;
|
||||||
this.ny = ny;
|
this.ny = ny;
|
||||||
|
|
||||||
@ -207,6 +205,8 @@ export class FloorViewport implements ILayerGroupRenderExtends {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// todo: 效果太差了,需要优化
|
||||||
|
return;
|
||||||
if (this.ox !== xTarget) {
|
if (this.ox !== xTarget) {
|
||||||
const time = transitionTime * Math.abs(xStart - xTarget);
|
const time = transitionTime * Math.abs(xStart - xTarget);
|
||||||
const progress = (now - xStartTime) / time;
|
const progress = (now - xStartTime) / time;
|
||||||
|
@ -504,6 +504,8 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
viewport.sync('startMove');
|
viewport.sync('startMove');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
viewport.sync('startMove');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +530,8 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
step: MoveStepDir,
|
step: MoveStepDir,
|
||||||
controller: IMoveController
|
controller: IMoveController
|
||||||
): Promise<HeroMoveCode> {
|
): Promise<HeroMoveCode> {
|
||||||
const showDir = toDir(this.moveDir);
|
const showDir = toDir(this.faceDir);
|
||||||
|
const dir4Move = toDir(this.moveDir);
|
||||||
core.setHeroLoc('direction', showDir);
|
core.setHeroLoc('direction', showDir);
|
||||||
|
|
||||||
const { x, y } = core.status.hero.loc;
|
const { x, y } = core.status.hero.loc;
|
||||||
@ -549,7 +552,7 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
|
|
||||||
// 检查传送门
|
// 检查传送门
|
||||||
if (!this.ignoreTerrain) {
|
if (!this.ignoreTerrain) {
|
||||||
const { portal, data } = this.checkPortal(x, y, showDir);
|
const { portal, data } = this.checkPortal(x, y, dir4Move);
|
||||||
if (portal && data) {
|
if (portal && data) {
|
||||||
this.portalData = data;
|
this.portalData = data;
|
||||||
await this.renderHeroSwap(data);
|
await this.renderHeroSwap(data);
|
||||||
@ -559,7 +562,7 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
|
|
||||||
const dir = this.moveDir;
|
const dir = this.moveDir;
|
||||||
if (!this.ignoreTerrain) {
|
if (!this.ignoreTerrain) {
|
||||||
const { noPass, canMove } = this.checkCanMove(x, y, showDir);
|
const { noPass, canMove } = this.checkCanMove(x, y, dir4Move);
|
||||||
|
|
||||||
if (!canMove) {
|
if (!canMove) {
|
||||||
return HeroMoveCode.CannotMove;
|
return HeroMoveCode.CannotMove;
|
||||||
@ -603,7 +606,7 @@ export class HeroMover extends ObjectMoverBase {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { x, y } = core.status.hero.loc;
|
const { x, y } = core.status.hero.loc;
|
||||||
const { x: nx, y: ny } = this.nextLoc(x, y, this.moveDir);
|
const { x: nx, y: ny } = this.nextLoc(x, y, this.moveDir);
|
||||||
const showDir = toDir(this.moveDir);
|
const showDir = toDir(this.faceDir);
|
||||||
|
|
||||||
// 前方不能移动
|
// 前方不能移动
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user