Hi, I just recently figured out how delegates and events work and I decided to give them a go. However I got confused again.
public delegate float Scored(); public static event Scored OnScore;
I’m having several issues regarding the implementation.
Should the event be in an EventManager script or should I stick this code in the Items that yield the score? How does the data get passed between the scripts? I want when an item is collected, the score tracking script to get the score float.
But as far as I understand the float return type doesn’t do anything it’s just the method signature.
public delegate void Scored(float score); public static event Scored OnScored;
This way it seems that I will have to pass the score float, but since firing the event has to occur from this script, that would mean that if I subscribe with my items I will be sending the score from the EventManager to the Item, but it has to go the other way around.