public void AddCharacter(CharacterProperties characterData) { if (!listCharacter.ContainsKey(characterData.id)) { listCharacter.Add(characterData.id, characterData); IOMethods.Instance.WriteData <CharacterProperties>(path, listCharacter); } }
public bool LearnSkill(int idCharacter, int idSkill) { CharacterProperties character = characterManager.GetCharater(idCharacter); SkillData skill = skillManager.GetSkill(idSkill); if (character.LearnSkill(skill)) { characterManager.UpdateData(character); return(true); } return(false); }
public CharacterProperties Clone() { CharacterProperties data = new CharacterProperties(); data.id = id; data.characterName = characterName; data.hp = hp; data.mp = mp; data.hpRegen = hpRegen; data.mpRegen = mpRegen; data.listSkill = new List <SkillData>(); for (int i = 0; i < listSkill.Count; i++) { SkillData skillData = listSkill[i].Clone(); data.listSkill.Add(skillData); } return(data); }
public void UpdateData(CharacterProperties character) { listCharacter[character.id] = character; IOMethods.Instance.WriteData <CharacterProperties>(path, listCharacter); }
public void CreateCharacter(string name, float hp, float mp, float hpRegen, float mpRegen) { CharacterProperties newChar = new CharacterProperties(name, hp, mp, hpRegen, mpRegen); AddCharacter(newChar); }
public void PrintCharacter(CharacterProperties character) { Console.WriteLine(Ultils.FormatText(character.id.ToString(), 10) + Ultils.FormatText(character.characterName, 25) + Ultils.FormatText(character.hp.ToString()) + Ultils.FormatText(character.mp.ToString())); }
public MyCharacter(CharacterProperties characterProperties) { this.characterProperties = characterProperties; }