ConceptCreator/src/app/project/game-model/gamesystems/Gamesystem.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

32 lines
976 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
generateIsolatedStates: boolean = false
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;
}
}