Hi,
Well, you'll be using this manager throughout your features around your game.
For this, you'll be using "Get fsm xxx" targeting this manager and you'll be getting whatever value from it.
So let's say we have a score manager. and we dont' want this to be a global. so we have a "__SCORE_MANAGER__" gameobject, with a "Score Manager" fsm, with a variables "Score".
everytime your player pick a star, you will fire an event "PLAYER / PICK / STAR". you broadcast it, you don't care of anything else. the star destroy itself and it doesn't care about scoring.
the "Score Manager" fsm catches this "PLAYER / PICK / STAR", and add 10 to its score variable. then it fires a event "SCORE / HAS UPDATED", and you PASS the score value to the event data. now your UI text showing the score can catch this and update. it simply gets the int value from the event info and update the text.
no global involved, everyone sticks to its purpose and doesn't care about how other managers features work.
If you have an fsm that was just created and did not get any events and needs to know the score. it can simply find the "__SCORE_MANAGER__" ( best using Unity tags, and do it once only for each fsm). Then use GetFsmInt targeting the fsm and variable on that gameobject.
just one more note, on the star pick up. you can go all the way and have many different stars with different weight for scoring, one would socre +10, but another one could score +50. don't hardcode this in the score manager, instead two solutions:
1: pass this value in the event "PLAYER / PICK / STAR" then the score manager check for that and adds whatever what passed with this event.
2: The star send that event "PLAYER / PICK / STAR". The score manager catches it and get the gameobject who sent this event and use "getFsmxxx" to get what ever values it needs from the star GameObject.
The second approach is SOO powerful, because if you create strict conventions between objects, you can then interface with them. if you agree that each pick up items will have an fsm named "Pickup" with a "score" int value, then your game can grow and have more and more different pickup items, the score system will work and do not care about the diversity of pickups.
If you can master this kind of dance, you'll be creating very rich systems in no time.
Bye,
Jean