Add related Templatesystem as specified Gamesystems
All checks were successful
E2E Testing / test (push) Successful in 1m34s

This commit is contained in:
Sebastian Böckelmann 2024-04-14 11:35:24 +02:00
parent 10a32df859
commit 49521cba87

View File

@ -4,6 +4,8 @@ import {TemplateElement} from "../templates/TemplateElement";
import {TemplateGamesystem} from "../templates/TemplateGamesystem"; import {TemplateGamesystem} from "../templates/TemplateGamesystem";
import {Gamesystem} from "../gamesystems/Gamesystem"; import {Gamesystem} from "../gamesystems/Gamesystem";
import {SimpleTemplateGamesystem} from "../templates/simpleGamesystem/SimpleTemplateGamesystem"; import {SimpleTemplateGamesystem} from "../templates/simpleGamesystem/SimpleTemplateGamesystem";
import {ProductTemplateSystem} from "../templates/productGamesystem/ProductTemplateSystem";
import {ProductGamesystem} from "../gamesystems/ProductGamesystem";
export class Character extends ModelComponent implements TemplateElement { export class Character extends ModelComponent implements TemplateElement {
@ -13,10 +15,20 @@ export class Character extends ModelComponent implements TemplateElement {
super(componentName, componentDescription, ModelComponentType.CHARACTER); super(componentName, componentDescription, ModelComponentType.CHARACTER);
} }
addCharacterSpecificSimpleTemplatesystem(gamesystem: SimpleTemplateGamesystem) { addCharacterSpecificSimpleTemplatesystem(gamesystem: Gamesystem<any, any>) {
if(!this.isTemplateSystemCharacterSpecific(gamesystem.componentName)) { if(!this.isTemplateSystemCharacterSpecific(gamesystem.componentName)) {
this.characterSpecificTemplateSystems.push(gamesystem) if(gamesystem instanceof SimpleTemplateGamesystem) {
gamesystem.addTemplateElement(this) 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)
}
} }
} }