예제 #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
파일: Fleet.cs 프로젝트: lyu0912/ing
        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
파일: Ship.cs 프로젝트: wbsdty331/ing
 private void UpdateFromSlot()
 {
     AirFightPower = Slots.Sum(x => x.AirFightPower);
     EffectiveLoS  = new LineOfSight(Slots.Sum(x => x.EffectiveLoS), Math.Sqrt(LineOfSight.Current));
 }