diff --git a/src/app/project/game-model/gamesystems/SimpleGamesystem.ts b/src/app/project/game-model/gamesystems/SimpleGamesystem.ts index c602bfc..c28e78e 100644 --- a/src/app/project/game-model/gamesystems/SimpleGamesystem.ts +++ b/src/app/project/game-model/gamesystems/SimpleGamesystem.ts @@ -4,7 +4,7 @@ import {SimpleState} from "./states/SimpleState"; import {SimpleTransition} from "./transitions/SimpleTransition"; export class SimpleGamesystem extends Gamesystem { - + templateSystems: SimpleTemplateGamesystem[] = [] createState(label: string, description: string): SimpleState | undefined { if(label == null) { @@ -18,6 +18,8 @@ export class SimpleGamesystem extends Gamesystem const state = new SimpleState(label, description); if(this.states.find(s => s.stateLabel == label) == undefined) { this.states.push(state); + + this.templateSystems.forEach(templatesystem => templatesystem.createState(label, description)) return state; } else { return undefined @@ -55,4 +57,8 @@ export class SimpleGamesystem extends Gamesystem protected findStateByStateLabel(stateLabel: string) { return this.states.find(state => stateLabel === stateLabel); } + + addTemplateSystem(templateSystem: SimpleTemplateGamesystem) { + this.templateSystems.push(templateSystem) + } } diff --git a/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts index 4e08528..61184e4 100644 --- a/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts +++ b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts @@ -35,7 +35,7 @@ export class SimpleTemplateGamesystem extends SimpleGamesystem { this.transitions.push(templateTransition); }) - + this.referenceSystem.addTemplateSystem(this) }