import {TemplateElement} from "../templates/TemplateElement"; import {Character} from "./Character"; import {ProductTemplateSystem} from "../templates/productGamesystem/ProductTemplateSystem"; import {Gamesystem} from "../gamesystems/Gamesystem"; import {SimpleTemplateGamesystem} from "../templates/simpleGamesystem/SimpleTemplateGamesystem"; import {TemplateType} from "../templates/TemplateType"; import {ProductTemplateCreator} from "../templates/productGamesystem/ProductTemplateCreator"; export class CharacterRelation implements TemplateElement{ firstCharacter: Character secondCharacter: Character characterRelationGamesystems: ProductTemplateSystem[] = [] constructor(firstCharacter: Character, secondCharacter: Character) { this.firstCharacter = firstCharacter; this.secondCharacter = secondCharacter; } addCharacterRelationSystem(gamesystem: Gamesystem) { if((gamesystem instanceof SimpleTemplateGamesystem || gamesystem instanceof ProductTemplateSystem) && !this.isGamesystemCharacterRelationSpecific(gamesystem.componentName)) { const templateGamesystem = new ProductTemplateSystem(gamesystem.componentName, gamesystem.componentDescription, TemplateType.CHARACTER_RELATION); templateGamesystem.symmetric = gamesystem.symmetric templateGamesystem.addChildGamesystem(gamesystem); templateGamesystem.addChildGamesystem(gamesystem); this.characterRelationGamesystems.push(templateGamesystem); templateGamesystem.addTemplateElement(this); } else { console.log("Test") } } private isGamesystemCharacterRelationSpecific(gamesystemName: string) { return this.characterRelationGamesystems.find(gamesystem => gamesystem.componentName === gamesystemName) != undefined } }