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