GameModel Support for Characters
All checks were successful
E2E Testing / test (push) Successful in 6m17s

This commit is contained in:
Sebastian Boeckelmann 2024-04-07 16:29:34 +02:00
parent ef9f24544a
commit 35f4919c51
4 changed files with 29 additions and 2 deletions

View File

@ -3,7 +3,8 @@
"cli": { "cli": {
"schematicCollections": [ "schematicCollections": [
"@angular-eslint/schematics" "@angular-eslint/schematics"
] ],
"analytics": false
}, },
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",

View File

@ -5,6 +5,7 @@ import {State} from "./gamesystems/states/State";
import {ProductGamesystem} from "./gamesystems/ProductGamesystem"; import {ProductGamesystem} from "./gamesystems/ProductGamesystem";
import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem"; import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem";
import {StorageModel} from "./fs/StorageModel"; import {StorageModel} from "./fs/StorageModel";
import { Character } from "./characters/Character";
export class GameModel { export class GameModel {
gameModelName: string gameModelName: string
@ -12,6 +13,8 @@ export class GameModel {
gamesystems: Gamesystem<any, any>[] = []; gamesystems: Gamesystem<any, any>[] = [];
scriptAccounts: ScriptAccount[] = []; scriptAccounts: ScriptAccount[] = [];
characters: Character[] = []
constructor(gameModelName: string) { constructor(gameModelName: string) {
this.gameModelName = gameModelName; this.gameModelName = gameModelName;
} }
@ -97,4 +100,16 @@ export class GameModel {
} }
}) })
} }
addCharacter(character: Character) {
const duplicateCharacter = this.characters.filter(c => c.componentName === character.componentName).length > 0;
if(!duplicateCharacter) {
this.characters.push(character);
}
}
removeCharacter(character: Character) {
this.characters = this.characters.filter(c => c.componentName !== character.componentName);
}
} }

View File

@ -1,5 +1,6 @@
export enum ModelComponentType { export enum ModelComponentType {
SCRIPTACCOUNT, SCRIPTACCOUNT,
GAMESYTEM GAMESYTEM,
CHARACTER
} }

View File

@ -0,0 +1,10 @@
import { ModelComponent } from "../ModelComponent";
import { ModelComponentType } from "../ModelComponentType";
export class Character extends ModelComponent {
constructor(characterName: string, characterDescription: string) {
super(characterName, characterDescription, ModelComponentType.CHARACTER)
}
}