示例#1
0
文件: Budget.cs 项目: the-qmark/DTF
    private IEnumerator Income()
    {
        WaitForSeconds oneSec = new WaitForSeconds(1f);

        while (true)
        {
            budget += allIncome;
            budget  = Mathf.Clamp(budget, 0f, 2000f);
            BudgetChange?.Invoke(budget);
            yield return(oneSec);
        }
    }
示例#2
0
文件: Budget.cs 项目: the-qmark/DTF
 public bool BuyIfCan(float _cost)
 {
     if (_cost <= budget)
     {
         budget -= _cost;
         BudgetChange?.Invoke(budget);
         return(true);
     }
     else
     {
         return(false);
     }
 }