private IEnumerator Income() { WaitForSeconds oneSec = new WaitForSeconds(1f); while (true) { budget += allIncome; budget = Mathf.Clamp(budget, 0f, 2000f); BudgetChange?.Invoke(budget); yield return(oneSec); } }
public bool BuyIfCan(float _cost) { if (_cost <= budget) { budget -= _cost; BudgetChange?.Invoke(budget); return(true); } else { return(false); } }