diff --git a/src/app/project/game-model/characters/Character.ts b/src/app/project/game-model/characters/Character.ts index 8f2fe49..a35e773 100644 --- a/src/app/project/game-model/characters/Character.ts +++ b/src/app/project/game-model/characters/Character.ts @@ -4,6 +4,8 @@ import {TemplateElement} from "../templates/TemplateElement"; import {TemplateGamesystem} from "../templates/TemplateGamesystem"; import {Gamesystem} from "../gamesystems/Gamesystem"; import {SimpleTemplateGamesystem} from "../templates/simpleGamesystem/SimpleTemplateGamesystem"; +import {ProductTemplateSystem} from "../templates/productGamesystem/ProductTemplateSystem"; +import {ProductGamesystem} from "../gamesystems/ProductGamesystem"; export class Character extends ModelComponent implements TemplateElement { @@ -13,10 +15,20 @@ export class Character extends ModelComponent implements TemplateElement { super(componentName, componentDescription, ModelComponentType.CHARACTER); } - addCharacterSpecificSimpleTemplatesystem(gamesystem: SimpleTemplateGamesystem) { + addCharacterSpecificSimpleTemplatesystem(gamesystem: Gamesystem) { if(!this.isTemplateSystemCharacterSpecific(gamesystem.componentName)) { - this.characterSpecificTemplateSystems.push(gamesystem) - gamesystem.addTemplateElement(this) + if(gamesystem instanceof SimpleTemplateGamesystem) { + this.characterSpecificTemplateSystems.push(gamesystem) + gamesystem.addTemplateElement(this) + } else if(gamesystem instanceof ProductTemplateSystem) { + this.characterSpecificTemplateSystems.push(gamesystem) + gamesystem.addTemplateElement(this) + gamesystem.innerGamesystems.forEach(innerGamesystem => this.addCharacterSpecificSimpleTemplatesystem(innerGamesystem)) + } + + if(gamesystem.parentGamesystem != undefined) { + this.addCharacterSpecificSimpleTemplatesystem(gamesystem.parentGamesystem) + } } }