ConceptCreator/src/app/project/game-model/characters/Character.ts
2024-04-11 15:51:09 +02:00

25 lines
1.0 KiB
TypeScript

import {ModelComponent} from "../ModelComponent";
import {ModelComponentType} from "../ModelComponentType";
import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem";
export class Character extends ModelComponent{
characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
constructor(componentName: string, componentDescription: string) {
super(componentName, componentDescription, ModelComponentType.CHARACTER);
}
addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem<Character>) {
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
}
}