ConceptCreator/src/app/project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem.ts
Sebastian Böckelmann 5b1e711a11
Some checks failed
E2E Testing / test (push) Failing after 1m29s
Change symmetric default values to be false
2024-04-19 19:56:04 +02:00

44 lines
1.6 KiB
TypeScript

import {SimpleGamesystem} from "../../gamesystems/SimpleGamesystem";
import {TemplateGamesystem} from "../TemplateGamesystem";
import {TemplateElement} from "../TemplateElement";
import {SimpleState} from "../../gamesystems/states/SimpleState";
import {SimpleTransition} from "../../gamesystems/transitions/SimpleTransition";
import {SimpleTemplateState} from "./SimpleTemplateState";
import {SimpleTemplateTransition} from "./SimpleTemplateTransition";
import {TemplateType} from "../TemplateType";
export class SimpleTemplateGamesystem extends SimpleGamesystem implements TemplateGamesystem {
templateType: TemplateType
symmetric: boolean = false
constructor(gamesystemName: string, gamesystemDescription: string, templateType: TemplateType) {
super(gamesystemName, gamesystemDescription);
this.templateType = templateType;
}
addTemplateElement(templateElement: TemplateElement): void {
this.states.forEach(state => {
(state as SimpleTemplateState).addTemplateElement(templateElement);
})
this.transitions.forEach(transition => {
(transition as SimpleTemplateTransition).addTemplateElement(templateElement);
})
}
createState(label: string, description: string): SimpleState | undefined {
const state = new SimpleTemplateState(label, description);
this.states.push(state)
return state;
}
createTransition(startingState: SimpleState, endingState: SimpleState): SimpleTransition | undefined {
return new SimpleTemplateTransition(startingState, endingState);
}
removeState(state: SimpleState): boolean {
return super.removeState(state);
}
}