更新文档

This commit is contained in:
YHH
2025-08-14 18:44:04 +08:00
parent 85cd93e51a
commit a5f0c8f6b5

View File

@@ -57,7 +57,7 @@ const scene = new Scene();
Core.setScene(scene); Core.setScene(scene);
// 定义组件 // 定义组件
@ECSComponent('Position') @ECSComponent('PositionComponent')
class PositionComponent extends Component { class PositionComponent extends Component {
public x: number = 0; public x: number = 0;
public y: number = 0; public y: number = 0;
@@ -87,7 +87,7 @@ entity.addComponent(new PositionComponent(100, 100));
entity.addComponent(new VelocityComponent(5, 0)); entity.addComponent(new VelocityComponent(5, 0));
// 创建系统 // 创建系统
@ECSSystem('Movement') @ECSSystem('MovementSystem')
class MovementSystem extends EntitySystem { class MovementSystem extends EntitySystem {
constructor() { constructor() {
super(Matcher.all(PositionComponent, VelocityComponent)); super(Matcher.all(PositionComponent, VelocityComponent));
@@ -118,20 +118,20 @@ Core.update(deltaTime);
import { ECSComponent, ECSSystem } from '@esengine/ecs-framework'; import { ECSComponent, ECSSystem } from '@esengine/ecs-framework';
// 组件装饰器 // 组件装饰器
@ECSComponent('Position') @ECSComponent('PositionComponent')
class PositionComponent extends Component { class PositionComponent extends Component {
public x: number = 0; public x: number = 0;
public y: number = 0; public y: number = 0;
} }
@ECSComponent('Velocity') @ECSComponent('VelocityComponent')
class VelocityComponent extends Component { class VelocityComponent extends Component {
public x: number = 0; public x: number = 0;
public y: number = 0; public y: number = 0;
} }
// 系统装饰器 // 系统装饰器
@ECSSystem('Movement') @ECSSystem('MovementSystem')
class MovementSystem extends EntitySystem { class MovementSystem extends EntitySystem {
constructor() { constructor() {
super(Matcher.all(PositionComponent, VelocityComponent)); super(Matcher.all(PositionComponent, VelocityComponent));
@@ -151,7 +151,7 @@ class MovementSystem extends EntitySystem {
import { Matcher, ECSSystem } from '@esengine/ecs-framework'; import { Matcher, ECSSystem } from '@esengine/ecs-framework';
// 使用Matcher和EntitySystem进行高效查询 // 使用Matcher和EntitySystem进行高效查询
@ECSSystem('Query') @ECSSystem('QuerySystem')
class QuerySystem extends EntitySystem { class QuerySystem extends EntitySystem {
constructor() { constructor() {
super(Matcher.all(PositionComponent, VelocityComponent).none(HealthComponent)); super(Matcher.all(PositionComponent, VelocityComponent).none(HealthComponent));
@@ -164,7 +164,7 @@ class QuerySystem extends EntitySystem {
} }
// 更复杂的查询条件 // 更复杂的查询条件
@ECSSystem('Combat') @ECSSystem('CombatSystem')
class CombatSystem extends EntitySystem { class CombatSystem extends EntitySystem {
constructor() { constructor() {
super( super(