diff --git a/src/app/project/game-model/characters/Character.ts b/src/app/project/game-model/characters/Character.ts index af8173e..cba8e91 100644 --- a/src/app/project/game-model/characters/Character.ts +++ b/src/app/project/game-model/characters/Character.ts @@ -43,7 +43,22 @@ export class Character extends ModelComponent implements TemplateElement { addAsymetricCharacterRelationGamesystem(gamesystem: Gamesystem, recursiveCall: boolean = false) { if(!this.isTemplateSystemCharacterRelationSpecific(gamesystem.componentName)) { - this.assymetricCharacterRelationSpecificTemplateSystems.push(gamesystem) + if(gamesystem instanceof SimpleTemplateGamesystem) { + this.assymetricCharacterRelationSpecificTemplateSystems.push(gamesystem); + gamesystem.addTemplateElement(this); + } else if(gamesystem instanceof ProductTemplateSystem) { + this.characterSpecificTemplateSystems.push(gamesystem); + gamesystem.addTemplateElement(this); + + if(!recursiveCall) { + gamesystem.innerGamesystems.forEach(innerGamesystem => this.addAsymetricCharacterRelationGamesystem(innerGamesystem, true)) + } + } + + if(gamesystem.parentGamesystem != undefined) { + this.addAsymetricCharacterRelationGamesystem(gamesystem.parentGamesystem, true) + } + } }