44 lines
1.6 KiB
TypeScript
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);
|
|
}
|
|
}
|