36 lines
925 B
TypeScript
36 lines
925 B
TypeScript
import {SimpleGamesystem} from "./SimpleGamesystem";
|
|
import {ProductGamesystem} from "./ProductGamesystem";
|
|
import {ModelComponent} from "../ModelComponent";
|
|
import {ModelComponentType} from "../ModelComponentType";
|
|
|
|
export abstract class Gamesystem<S, T> extends ModelComponent{
|
|
|
|
states: S[] = [];
|
|
transitions: T[] = [];
|
|
constructor(gamesystemName: string) {
|
|
super(gamesystemName, "", ModelComponentType.GAMESYTEM);
|
|
}
|
|
|
|
abstract createState(label: string, description: string): S|undefined;
|
|
|
|
abstract createTransition(startingState: S, endingState: S): T|undefined;
|
|
|
|
abstract removeState(state: S): boolean;
|
|
|
|
removeTransition(transition: T): boolean {
|
|
const updatedTransitions = this.transitions.filter(t => t !== transition);
|
|
if(updatedTransitions.length == this.transitions.length) {
|
|
return false;
|
|
}
|
|
|
|
this.transitions = updatedTransitions;
|
|
return true;
|
|
}
|
|
|
|
|
|
save() {
|
|
|
|
}
|
|
|
|
}
|