Exemple #1
0
        /// <summary>
        ///     Функция для добавления солдат в отряд
        /// </summary>
        /// <param name="fighterType">Тип бойца</param>
        /// <param name="count">Количество добавляемых бойцов</param>
        public void AddFighters(FighterType fighterType, int count)
        {
            int lastIndex = FindLastNull();

            switch (fighterType)
            {
            case FighterType.Samurai:
                for (int i = 0; i < count; i++)
                {
                    this[lastIndex + i] = Samurai.GenerateNewFighter(isPlayerSquad, lastIndex + i);
                }
                break;

            case FighterType.Ninja:
                for (int i = 0; i < count; i++)
                {
                    this[lastIndex + i] = Ninja.GenerateNewFighter(isPlayerSquad, lastIndex + i);
                }
                break;

            case FighterType.Fighter:
                for (int i = 0; i < count; i++)
                {
                    this[lastIndex + i] = Fighter.GenerateNewFighter(isPlayerSquad, lastIndex + i);
                }
                break;
            }
        }
Exemple #2
0
        /// <summary>
        ///     Функция для рандомизации отряда
        /// </summary>
        public void GetRandomSquad()
        {
            Random rnd = new Random();

            for (int i = 0; i < Length; i++)
            {
                int randomChance = rnd.Next(1, 101);
                if (randomChance <= 45)
                {
                    this[i] = Fighter.GenerateNewFighter(isPlayerSquad, i);
                }
                if (randomChance > 45 && randomChance <= 75)
                {
                    this[i] = Ninja.GenerateNewFighter(isPlayerSquad, i);
                }
                if (randomChance > 75 && randomChance < 101)
                {
                    this[i] = Samurai.GenerateNewFighter(isPlayerSquad, i);
                }
            }
        }