Beispiel #1
0
 public void AddCharacter(CharacterProperties characterData)
 {
     if (!listCharacter.ContainsKey(characterData.id))
     {
         listCharacter.Add(characterData.id, characterData);
         IOMethods.Instance.WriteData <CharacterProperties>(path, listCharacter);
     }
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public void UpdateData(CharacterProperties character)
 {
     listCharacter[character.id] = character;
     IOMethods.Instance.WriteData <CharacterProperties>(path, listCharacter);
 }
Beispiel #5
0
        public void CreateCharacter(string name, float hp, float mp, float hpRegen, float mpRegen)
        {
            CharacterProperties newChar = new CharacterProperties(name, hp, mp, hpRegen, mpRegen);

            AddCharacter(newChar);
        }
Beispiel #6
0
 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()));
 }
Beispiel #7
0
 public MyCharacter(CharacterProperties characterProperties)
 {
     this.characterProperties = characterProperties;
 }