fix(spatial): 修复 GridAOI 可见性更新问题
- 修复 addObserver 时现有观察者无法检测到新实体的问题 - 修复实体远距离移动时观察者可见性未正确更新的问题 - 重构 demos 抽取公共测试工具
This commit is contained in:
41
packages/tools/demos/src/utils.ts
Normal file
41
packages/tools/demos/src/utils.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @zh Demo 测试工具函数
|
||||
* @en Demo test utility functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @zh 断言条件为真,否则抛出错误
|
||||
* @en Assert condition is true, otherwise throw error
|
||||
*/
|
||||
export function assert(condition: boolean, message: string): void {
|
||||
if (!condition) throw new Error(`FAILED: ${message}`);
|
||||
console.log(` ✓ ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @zh 打印测试章节标题
|
||||
* @en Print test section header
|
||||
*/
|
||||
export function section(name: string): void {
|
||||
console.log(`\n▶ ${name}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @zh 打印 Demo 开始标题
|
||||
* @en Print demo start header
|
||||
*/
|
||||
export function demoHeader(name: string): void {
|
||||
console.log('═══════════════════════════════════════');
|
||||
console.log(` ${name}`);
|
||||
console.log('═══════════════════════════════════════');
|
||||
}
|
||||
|
||||
/**
|
||||
* @zh 打印 Demo 结束标题
|
||||
* @en Print demo end header
|
||||
*/
|
||||
export function demoFooter(name: string): void {
|
||||
console.log('\n═══════════════════════════════════════');
|
||||
console.log(` ${name}: ALL TESTS PASSED ✓`);
|
||||
console.log('═══════════════════════════════════════\n');
|
||||
}
|
||||
Reference in New Issue
Block a user