feat(walk-control): 对接漫游功能到底层 API
This commit is contained in:
@@ -55,22 +55,30 @@ export class WalkControlManager extends BaseManager {
|
||||
this.emit('walk:path-mode-toggle', { isActive });
|
||||
},
|
||||
onWalkModeToggle: (isActive) => {
|
||||
console.log('[WalkControl] 漫游模式:', isActive);
|
||||
console.log('[WalkControl] 第一人称漫游:', isActive);
|
||||
if (isActive) {
|
||||
this.pathManager?.hide();
|
||||
this.registry.engine3d?.activateFirstPersonMode();
|
||||
} else {
|
||||
this.registry.engine3d?.deactivateFirstPersonMode();
|
||||
}
|
||||
this.emit('walk:walk-mode-toggle', { isActive });
|
||||
},
|
||||
onSpeedChange: (speed) => {
|
||||
console.log('[WalkControl] 速度变化:', speed);
|
||||
// 将 UI 速度值转换为引擎速度值(UI: 1-10, 引擎: 0.01-0.1)
|
||||
const engineSpeed = speed * 0.01;
|
||||
this.registry.engine3d?.setWalkSpeed(engineSpeed);
|
||||
this.emit('walk:speed-change', { speed });
|
||||
},
|
||||
onGravityToggle: (enabled) => {
|
||||
console.log('[WalkControl] 重力:', enabled);
|
||||
this.registry.engine3d?.setWalkGravity(enabled);
|
||||
this.emit('walk:gravity-toggle', { enabled });
|
||||
},
|
||||
onCollisionToggle: (enabled) => {
|
||||
console.log('[WalkControl] 碰撞:', enabled);
|
||||
this.registry.engine3d?.setWalkCollision(enabled);
|
||||
this.emit('walk:collision-toggle', { enabled });
|
||||
},
|
||||
onCharacterModelChange: (model) => {
|
||||
|
||||
Reference in New Issue
Block a user