Beispiel #1
0
        public object Load(string file)
        {
            List <ICharacter> EnemyList = new List <ICharacter>();

            string           JSONstring    = System.IO.File.ReadAllText(file);
            List <tempEnemy> tempEnemyList = JsonConvert.DeserializeObject <List <tempEnemy> >(JSONstring);

            for (int i = 0; i < tempEnemyList.Count; i++)
            {
                Enemy e = new Enemy(tempEnemyList[i].name, tempEnemyList[i].level, tempEnemyList[i].hp, tempEnemyList[i].energy, tempEnemyList[i].images);
                for (int k = 0; k < tempEnemyList[i].attacks.Count; k++)
                {
                    e.AddAttack(tempEnemyList[i].attacks[k], this.attackList);
                }

                EnemyList.Add(e);
            }

            return(EnemyList);
        }