Files
cocos/assets/scripts/core/GridConstants.ts
刘宇飞 d393302388 Complete Cocos Creator port with level bundles, themes, and tooling.
Adds level prefabs, theme assets, audio, extensions, and deployment scripts for the Unity WebGL migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 15:30:58 +08:00

34 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 等距网格常量(独立模块,避免 AppBootstrap ↔ GridCoords 循环依赖) */
export const CELL_PIXEL = 100;
/** Unity Player.prefab moveSpeed=1.2、Vehicle.prefab=1按格子像素等比换算 */
export const UNITY_PLAYER_MOVE_SPEED = 1.2;
export const UNITY_VEHICLE_MOVE_SPEED = 1;
/** Unity PlayerController 跳上 JumpBlock 时 targetPosition.y += 0.15 */
export const UNITY_JUMP_ARC_OFFSET = 0.15;
/** 移动中拾取步进进度达到该比例且进入道具格后才消失01 */
export const PROP_COLLECT_MOVE_PROGRESS = 0.62;
/** 移动中拾取:角色与道具世界距离上限(相对 CELL_PIXEL */
export const PROP_COLLECT_TOUCH_RADIUS = 0.42;
export function scaledJumpArcOffset(): number {
return UNITY_JUMP_ARC_OFFSET * CELL_PIXEL;
}
export function scaledMoveSpeed(unitySpeed: number): number {
return unitySpeed * CELL_PIXEL;
}
/** 与 Unity Web 模板 canvas 一致Template/index.html 960×600 */
export const DESIGN_WIDTH = 960;
export const DESIGN_HEIGHT = 600;
/** Unity Main Camera orthographicSize=5 → 半高 500px世界尺度不随设计分辨率变 */
export const CAMERA_ORTHO_HALF = 500;
export function getHalfCellSize(): { halfW: number; halfH: number } {
return { halfW: CELL_PIXEL * 0.5, halfH: CELL_PIXEL * 0.25 };
}