Update States of template when reference gets new state
All checks were successful
E2E Testing / test (push) Successful in 1m37s
All checks were successful
E2E Testing / test (push) Successful in 1m37s
This commit is contained in:
parent
d643f6bb1c
commit
c1ed3799bd
@ -4,7 +4,7 @@ import {SimpleState} from "./states/SimpleState";
|
||||
import {SimpleTransition} from "./transitions/SimpleTransition";
|
||||
export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition> {
|
||||
|
||||
|
||||
templateSystems: SimpleTemplateGamesystem[] = []
|
||||
|
||||
createState(label: string, description: string): SimpleState | undefined {
|
||||
if(label == null) {
|
||||
@ -18,6 +18,8 @@ export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition>
|
||||
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<SimpleState, SimpleTransition>
|
||||
protected findStateByStateLabel(stateLabel: string) {
|
||||
return this.states.find(state => stateLabel === stateLabel);
|
||||
}
|
||||
|
||||
addTemplateSystem(templateSystem: SimpleTemplateGamesystem) {
|
||||
this.templateSystems.push(templateSystem)
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export class SimpleTemplateGamesystem extends SimpleGamesystem {
|
||||
this.transitions.push(templateTransition);
|
||||
})
|
||||
|
||||
|
||||
this.referenceSystem.addTemplateSystem(this)
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user