From 6a711ec579a7a1f79c612d878ac6fa538eb788c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 19 Apr 2024 13:49:01 +0200 Subject: [PATCH] Add Character as TemplateElement to added character-relation specific assymetric gamesystems --- .../project/game-model/characters/Character.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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) + } + } }