/
puma
/
ppa
Обзор
Документация
Войти
/
puma
/
ppa
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Factories/UnitFactoryProvider.cs
39 строк
2 KB
Margarita
vse
28 май 2026, 23:03
28 май 2026, 23:03
602881f
Код
Авторство
О чём код?
using Game.Models.Units.Adapters; /// <summary> /// Стандартная армия: создаёт обычных юнитов со случайными базовыми параметрами. /// </summary> public class UnitFactoryProvider : IUnitFactoryProvider { public IUnit CreateInfantry() => new LightInfantry(); public IUnit CreateHeavyInfantry() => new BuffableHeavyInfantry(); public IUnit CreateRangedUnit() => new ArcherFactory().CreateUnit(); public IUnit CreateSupportUnit() => new HealerFactory().CreateUnit(); public IUnit CreateMagicUnit() => new WizardFactory().CreateUnit(); public IUnit CreateSpecialUnit() => new GulyayGorodAdapterFactory().CreateUnit(); } /// <summary> /// Элитная армия: создаёт усиленных юнитов с повышенными характеристиками. /// </summary> public class EliteUnitFactoryProvider : IUnitFactoryProvider { public IUnit CreateInfantry() => new LightInfantry(Random.Shared.Next(25, 32), Random.Shared.Next(10, 15), Random.Shared.Next(35, 45), Random.Shared.Next(50, 65)); public IUnit CreateHeavyInfantry() => new BuffableHeavyInfantry(Random.Shared.Next(28, 38), Random.Shared.Next(18, 28), Random.Shared.Next(40, 55), Random.Shared.Next(65, 85)); public IUnit CreateRangedUnit() => new EliteArcherFactory().CreateUnit(); public IUnit CreateSupportUnit() => new Healer(Random.Shared.Next(12, 18), Random.Shared.Next(8, 14), Random.Shared.Next(28, 38), Random.Shared.Next(55, 70), Random.Shared.Next(2, 5), Random.Shared.Next(18, 28)); public IUnit CreateMagicUnit() => new Wizard(Random.Shared.Next(8, 15), Random.Shared.Next(8, 15), Random.Shared.Next(28, 38), Random.Shared.Next(65, 80), Random.Shared.Next(2, 4), Random.Shared.Next(45, 60)); public IUnit CreateSpecialUnit() => new GulyayGorodAdapter(0, Random.Shared.Next(30, 40), Random.Shared.Next(60, 80), Random.Shared.Next(90, 110)); }