public void AddFunds(float amount) { _cashMoney += amount; // This ? operator is called null propagation, and means it will only trigger // if OnUpdateBalance is not null. This is true only if there are no // subscribers to that event. OnUpdateBalance?.Invoke(); }
public void DeductFunds(float amount) { _cashMoney -= amount; OnUpdateBalance?.Invoke(); }