public void TryBuyItem(ShopItemView itemView) { if (CurrentMoneyCount > itemView.Item.Price) { CurrentMoneyCount -= itemView.Item.Price; itemView.ReduceCurrentAvailableCount(); MoneyCountChanged?.Invoke(CurrentMoneyCount); ItemBought?.Invoke(itemView); } }
private void Start() { CurrentMoneyCount = _startMoneyCount; MoneyCountChanged?.Invoke(CurrentMoneyCount); }
public void RecruitUnit(UnitStats unit) { _money -= unit.Price; MoneyCountChanged?.Invoke(_money); UnitRecruited?.Invoke(unit.Prefab); }
public void CollectMoney(int money) { _money += money; MoneyCountChanged?.Invoke(_money); }
private void Awake() { MoneyCountChanged?.Invoke(_money); }