25 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import {ModelComponent} from "../ModelComponent";
 | 
						|
import {ModelComponentType} from "../ModelComponentType";
 | 
						|
import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem";
 | 
						|
 | 
						|
export class Character extends ModelComponent{
 | 
						|
 | 
						|
  characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
 | 
						|
 | 
						|
  constructor(componentName: string, componentDescription: string) {
 | 
						|
    super(componentName, componentDescription, ModelComponentType.CHARACTER);
 | 
						|
  }
 | 
						|
 | 
						|
  addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem<Character>) {
 | 
						|
    if(!this.isGamesystemCharacterSpecific(templateGamesystem.componentName)) {
 | 
						|
      this.characterSpecificGamesystems.push(templateGamesystem);
 | 
						|
      templateGamesystem.addReferenceKey(this);
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  private isGamesystemCharacterSpecific(gamesystemName: string) {
 | 
						|
    const characterSpecificGamesystem = this.characterSpecificGamesystems.find(gamesystem => gamesystem.componentName === gamesystemName);
 | 
						|
    return characterSpecificGamesystem != undefined
 | 
						|
  }
 | 
						|
}
 |