ConceptCreator/src/app/game-model/gamesystems/Gamesystem.ts
Sebastian Böckelmann b68d2a812c
All checks were successful
E2E Testing / test (push) Successful in 1m31s
Delete Childsystems (and correct loading childgamesystems (relation was not loaded bidirectional))
2024-03-18 18:12:55 +01:00

30 lines
933 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[] = [];
parentGamesystem: ProductGamesystem | undefined
constructor(gamesystemName: string, gamesystemDescription: string) {
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
}
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;
}
}