Exemple #1
0
        //--------------------------------------------------------

        public void AddPerson(char sym, char realSym, string Name, List <string> data)//Добавление персонажа
        {
            Person person = new Person(realSym, Name, 0, 0, BaseGroups.GrFriends);

            foreach (string tag in data)
            {
                switch (tag)
                {
                case ("Friend"): person.group = BaseGroups.GrFriends; break;

                case ("Enemy"): person.group = BaseGroups.GrEnemies; break;

                case var someVal when new Regex(@"Health").IsMatch(tag): person.MaxHealth = GetNumeric(tag); break;

                case var someVal when new Regex(@"Charisma").IsMatch(tag): person.Perks.CurAbils.Charisma = GetNumeric(tag); break;

                case var someVal when new Regex(@"Agility").IsMatch(tag): person.Perks.CurAbils.Agility = GetNumeric(tag); break;

                case var someVal when new Regex(@"Inteligence").IsMatch(tag): person.Perks.CurAbils.Inteligence = GetNumeric(tag); break;

                case var someVal when new Regex(@"Strength").IsMatch(tag): person.Perks.CurAbils.Strength = GetNumeric(tag); break;

                case var someVal when new Regex(@"Level").IsMatch(tag):
                    int lvl    = 1;
                    int newLvl = GetNumeric(tag);
                    while (lvl < newLvl)
                    {
                        person.LevelUp(false);
                        lvl++;
                    }
                    break;

                default: break;
                }
            }

            if (count == 0)
            {
                missionSymTable.Add(sym, person);
            }

            else if (objects[count - 1] is BackGround)
            {
                ((Home)objects[count - 1]).AddDweller(person);
            }

            objects[count] = person;
            count          = 0;
        }