import * as THREE from 'three' import { System } from '../../src' import { ExampleEntity } from './example-entity' export class ExampleSystem extends System { addExampleEntity() { const entity = new ExampleEntity({ name: 'example-entity', position: new THREE.Vector3(0, 0, 0), rotation: new THREE.Euler(0, 0, 0) }) this.addEntity(entity) } onAdded(): void { this.addExampleEntity() const { EventManager } = this._app EventManager.subscribe( 'move', (data: any) => { const entity = this.getEntity('example-entity') entity && entity.updatePose(data.position, entity.Quaternion, data.animateTime) }, 'example-system' ) } onRemoved(): void { const { EventManager } = this._app EventManager.unsubscribeInScope('move', 'example-system') } onUpdating(deltaTime: number): void {} }