import {ModelComponent} from "../ModelComponent"; import {ModelComponentType} from "../ModelComponentType"; import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem"; export class Character extends ModelComponent{ characterSpecificGamesystems: SimpleTemplateGamesystem[] = [] constructor(componentName: string, componentDescription: string) { super(componentName, componentDescription, ModelComponentType.CHARACTER); } addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem) { if(!this.isGamesystemCharacterSpecific(templateGamesystem.componentName)) { this.characterSpecificGamesystems.push(templateGamesystem); templateGamesystem.addReferenceKey(this); } } private isGamesystemCharacterSpecific(gamesystemName: string) { const characterSpecificGamesystem = this.characterSpecificGamesystems.find(gamesystem => gamesystem.componentName === gamesystemName); return characterSpecificGamesystem != undefined } }