GameModel Support for Characters
All checks were successful
E2E Testing / test (push) Successful in 6m17s
All checks were successful
E2E Testing / test (push) Successful in 6m17s
This commit is contained in:
parent
ef9f24544a
commit
35f4919c51
@ -3,7 +3,8 @@
|
||||
"cli": {
|
||||
"schematicCollections": [
|
||||
"@angular-eslint/schematics"
|
||||
]
|
||||
],
|
||||
"analytics": false
|
||||
},
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
|
@ -5,6 +5,7 @@ import {State} from "./gamesystems/states/State";
|
||||
import {ProductGamesystem} from "./gamesystems/ProductGamesystem";
|
||||
import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem";
|
||||
import {StorageModel} from "./fs/StorageModel";
|
||||
import { Character } from "./characters/Character";
|
||||
|
||||
export class GameModel {
|
||||
gameModelName: string
|
||||
@ -12,6 +13,8 @@ export class GameModel {
|
||||
gamesystems: Gamesystem<any, any>[] = [];
|
||||
scriptAccounts: ScriptAccount[] = [];
|
||||
|
||||
characters: Character[] = []
|
||||
|
||||
constructor(gameModelName: string) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
export enum ModelComponentType {
|
||||
SCRIPTACCOUNT,
|
||||
GAMESYTEM
|
||||
GAMESYTEM,
|
||||
CHARACTER
|
||||
|
||||
}
|
||||
|
10
src/app/project/game-model/characters/Character.ts
Normal file
10
src/app/project/game-model/characters/Character.ts
Normal 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)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user