Example #1
0
 /// <summary>
 /// 是否有消耗
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool IsHaveCost(CostData <T> data)
 {
     if (data == null)
     {
         return(false);
     }
     return(GetAttrVal(data.Type) >= data.RealVal);
 }
Example #2
0
 public virtual void DoCost(CostData <T> datas, bool isReverse = false)
 {
     if (datas == null)
     {
         return;
     }
     if (isReverse)
     {
         ChangeVal(datas.Type, datas.RealVal);
     }
     else
     {
         ChangeVal(datas.Type, -datas.RealVal);
     }
 }