/// <summary> /// Registers a callback with one of the persistent strings, allowing the Get queries /// to be callback-based (Dependent variables) instead of polling. /// </summary> /// <param name="persistentName"></param> /// <param name="callback"></param> private void RegisterPersistentNotice(string persistentName, Action <double> callback) { PersistentChangedNotification notice; if (!persistentNotices.TryGetValue(persistentName, out notice)) { notice = new PersistentChangedNotification(); persistentNotices[persistentName] = notice; } notice.numericCallbacks += callback; }
/// <summary> /// Used to notify registered persistent value watchers that a persistent has /// changed. /// </summary> /// <param name="persistentName"></param> private void UpdatePersistent(string persistentName) { PersistentChangedNotification notice; if (!persistentNotices.TryGetValue(persistentName, out notice)) { notice = new PersistentChangedNotification(); persistentNotices[persistentName] = notice; } notice.TriggerCallbacks(); }