Пример #1
0
        public static LineOfSight Sum <TSource>(this IEnumerable <TSource> source, Func <TSource, LineOfSight> selector)
        {
            LineOfSight result = default;

            foreach (var item in source)
            {
                result += selector(item);
            }
            return(result);
        }
Пример #2
0
        protected void DoCalculations()
        {
            SlowestShipSpeed = Ships.AsList().Count > 0 ? Ships.Min(s => s.Speed) : ShipSpeed.None;
            SupplyingCost    = Ships.Sum(s => s.SupplyingCost);
            RepairingCost    = Ships.Sum(s => s.RepairingCost);
            AirFightPower    = Ships.Sum(s => s.AirFightPower);
            SimpleLoS        = Ships.Sum(s => s.LineOfSight.Displaying);
            var sumLoS = Ships.Sum(s => s.EffectiveLoS);

            EffectiveLoS = new LineOfSight(sumLoS.Multiplied, sumLoS.Baseline + 2 * (6 - Ships.AsList().Count), AdmiralLevel);
        }
Пример #3
0
 protected void DoCalculations()
 {
     using (EnterBatchNotifyScope())
     {
         bool isMarriaged = Leveling.Level >= 100;
         SupplyingCost = new Materials
         {
             Fuel    = isMarriaged ? (int)(Fuel.Shortage * 0.85) : Fuel.Shortage,
             Bullet  = isMarriaged ? (int)(Bullet.Shortage * 0.85) : Bullet.Shortage,
             Bauxite = Slots.Sum(x => x.Aircraft.Shortage) * 5
         };
         AirFightPower = Slots.Sum(x => x.AirFightPower);
         EffectiveLoS  = new LineOfSight(Slots.Sum(x => x.EffectiveLoS), Math.Sqrt(LineOfSight.Current));
     }
     CalculationUpdated?.Invoke();
 }
Пример #4
0
 private void UpdateFromSlot()
 {
     AirFightPower = Slots.Sum(x => x.AirFightPower);
     EffectiveLoS  = new LineOfSight(Slots.Sum(x => x.EffectiveLoS), Math.Sqrt(LineOfSight.Current));
 }