CharacterSpecific Templatesystems #36
@ -1,10 +1,27 @@
|
||||
import {ModelComponent} from "../ModelComponent";
|
||||
import {ModelComponentType} from "../ModelComponentType";
|
||||
import {TemplateElement} from "../templates/TemplateElement";
|
||||
import {TemplateGamesystem} from "../templates/TemplateGamesystem";
|
||||
import {Gamesystem} from "../gamesystems/Gamesystem";
|
||||
import {SimpleTemplateGamesystem} from "../templates/simpleGamesystem/SimpleTemplateGamesystem";
|
||||
|
||||
export class Character extends ModelComponent implements TemplateElement {
|
||||
|
||||
characterSpecificTemplateSystems: Gamesystem<any, any>[] = []
|
||||
|
||||
constructor(componentName: string, componentDescription: string) {
|
||||
super(componentName, componentDescription, ModelComponentType.CHARACTER);
|
||||
}
|
||||
|
||||
addCharacterSpecificSimpleTemplatesystem(gamesystem: SimpleTemplateGamesystem) {
|
||||
if(!this.isTemplateSystemCharacterSpecific(gamesystem.componentName)) {
|
||||
this.characterSpecificTemplateSystems.push(gamesystem)
|
||||
gamesystem.addTemplateElement(this)
|
||||
}
|
||||
}
|
||||
|
||||
private isTemplateSystemCharacterSpecific(gamesystemName: string) {
|
||||
return this.characterSpecificTemplateSystems.find(gamesystem => gamesystem.componentName === gamesystemName) != undefined
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ export class SimpleTemplateState extends SimpleState {
|
||||
conditionMap: Map<TemplateElement, ScriptAccountCondition[]> = new Map();
|
||||
|
||||
addTemplateElement(templateElement: TemplateElement) {
|
||||
this.conditionMap.set(templateElement, [])
|
||||
this.conditionMap.set(templateElement, this.conditions)
|
||||
}
|
||||
|
||||
removeTemplateElement(templateElement: TemplateElement) {
|
||||
|
@ -8,8 +8,8 @@ export class SimpleTemplateTransition extends SimpleTransition{
|
||||
actionMap: Map<TemplateElement, ScriptAccountAction[]> = new Map();
|
||||
|
||||
addTemplateElement(templateElement: TemplateElement) {
|
||||
this.conditionMap.set(templateElement, [])
|
||||
this.actionMap.set(templateElement, [])
|
||||
this.conditionMap.set(templateElement, this.scriptAccountConditions.concat())
|
||||
this.actionMap.set(templateElement, this.scriptAccountActions.concat())
|
||||
}
|
||||
|
||||
removeTemplateElement(templateElement: TemplateElement) {
|
||||
|
Loading…
Reference in New Issue
Block a user