private void OnDestroy() { if (Tracker != null) { CoinsForChangeTracker tracker = Tracker; tracker.OnCoinCountUpdated = (Action <long>)Delegate.Remove(tracker.OnCoinCountUpdated, new Action <long>(onTotalCoinsUpdated)); } }
private void Start() { if (Tracker != null) { SetCoinCount(Tracker.CurrentCoinCount, immediate: true); CoinsForChangeTracker tracker = Tracker; tracker.OnCoinCountUpdated = (Action <long>)Delegate.Combine(tracker.OnCoinCountUpdated, new Action <long>(onTotalCoinsUpdated)); } }
public void SetTracker(CoinsForChangeTracker tracker) { if (!(Tracker != null)) { if (tracker == null) { base.enabled = false; return; } Tracker = tracker; SetCoinCount(Tracker.CurrentCoinCount, immediate: true); CoinsForChangeTracker tracker2 = Tracker; tracker2.OnCoinCountUpdated = (Action <long>)Delegate.Combine(tracker2.OnCoinCountUpdated, new Action <long>(onTotalCoinsUpdated)); } }
public void Init(CoinsForChangeStation station, CoinsForChangeTracker tracker) { coinsForChangeStation = station; Counter.SetTracker(tracker); }