移除 Entity._localComponents/强制Entity必须属于Scene/简化组件操作逻辑

This commit is contained in:
YHH
2025-10-10 16:31:43 +08:00
parent bf14b59a28
commit 62d7521384
12 changed files with 158 additions and 158 deletions

View File

@@ -1,5 +1,6 @@
import { Component } from '../../src/ECS/Component';
import { Entity } from '../../src/ECS/Entity';
import { Scene } from '../../src/ECS/Scene';
// 测试组件
class TestComponent extends Component {
@@ -23,12 +24,13 @@ class AnotherTestComponent extends Component {
describe('Component - 组件基类测试', () => {
let component: TestComponent;
let entity: Entity;
let scene: Scene;
beforeEach(() => {
// Reset component ID generator to avoid BigInt issues
Component._idGenerator = 0;
component = new TestComponent();
entity = new Entity('TestEntity', 1);
scene = new Scene();
entity = scene.createEntity('TestEntity');
});
describe('基本功能', () => {