I have a class of static variables called GlobalVars in which I track… “global” variables.
Next I have GameController, BankManager and other classes…
Some actions in my game set variables in GlobalVars. I would like BankManger to be “notified” when particular vars change, so that some UI display will be updated accordingly.
Yes, I am describing something usually called Data Binding, but I don’t think I want to implement a full data binding solution. Is there an efficient way that a change of a variable could be detected, so that I then call the BankManager class to do its thing? All I can think of at the moment is using Update() in GlobalVars and have a list of duplicate variables so I can compare VAR1 == last_VAR1 but this seems terribly inefficient to compare every variable every frame update.
C#