import { DefaultEntity } from './default-entity' ; import { Prop } from './prop' ; import { ScalableProp } from './scalable-prop' ; import { ItemDestruct } from './item-destruct' ; import { NPC } from './npc' ; import { EventTrigger } from './event-trigger' ; import { Injectable } from '@angular/core' ; import { Destructible } from './destructible' ; import { CCEntity } from '../cc-entity' ; import { Enemy } from './enemy' ; @ Injectable ( ) export class EntityRegistryService { private entities : { [ type ] : typeof CCEntity ; } = { } ; constructor ( ) { this . register ( 'Prop' , Prop ) ; this . register ( 'ScalableProp' , ScalableProp ) ; this . register ( 'ItemDestruct' , ItemDestruct ) ; this . register ( 'Destructible' , Destructible ) ; this . register ( 'NPC' , NPC ) ; this . register ( 'EventTrigger' , EventTrigger ) ; this . register ( 'Enemy' , Enemy ) ; } private register ( type , entity ) { this . entities [ type ] = entity ; } public getDefaultEntity ( ) { return DefaultEntity ; } public getAll ( ) { return this . entities ; } public getEntity ( type ) { return ( this . entities [ type ] ?? DefaultEntity ) as typeof DefaultEntity ; } }