public void AddUnnecessaryConsumables(Dictionary <ConsumableData, int> all)
 {
     foreach (var item in all)
     {
         if (_has.ContainsKey(item.Key))
         {
             continue;
         }
         ConsumableToExpend cons = new ConsumableToExpend();
         cons.Resource = item.Key;
         cons.Spended  = 0;
         cons.Remain   = item.Value;
         expend.Add(cons);
     }
 }
        public void FormExpending()
        {
            expend = new List <ConsumableToExpend>();
            int has;

            foreach (ConsumableRate conNeed in _need)
            {
                ConsumableToExpend cons = new ConsumableToExpend();
                cons.Resource = conNeed.Resource;
                has           = Math.Min(_has[conNeed.Resource], conNeed.amountRate);
                cons.Spended  = has;
                cons.Remain   = _has[conNeed.Resource] - conNeed.amountRate;
                expend.Add(cons);
            }
        }
        public float CalculatePenalty()
        {
            float p = 0;

            foreach (ConsumableRate conNeed in _need)
            {
                ConsumableToExpend c = expend.SingleOrDefault(x => x.Resource == conNeed.Resource);
                if (c.Remain >= 0)
                {
                    continue;
                }
                p += c.Remain * conNeed.significanceRate;
            }
            penalty = p; //Remain in consumable to expend is negative
            return(penalty);
        }