Пример #1
0
        public static void SetArmy(this ICombatable c, Dictionary <UnitType, int> army)
        {
            if (army == c.Army)
            {
                return;
            }

            foreach (var kv in c.Army.Where(kv => !army.ContainsKey(kv.Key)).ToArray())
            {
                c.SetUnitsCount(kv.Key, 0);
            }

            foreach (var kv in army)
            {
                c.SetUnitsCount(kv.Key, kv.Value);
            }
        }