New answers tagged

1

Yes, setting a global variable and then calling a method which behaves differently based on its value is a dangerous anti-pattern known as "Accumulate and Fire". The remedy is to pass all data which is required by a method as parameters. In your case the solution is to not use generic event handlers to enter a state. Give each state an unique Enter method ...


0

A fine way to handle in a discrete way communications between entities is the Oberver pattern. Take a look at it. each entity who need observation will need to add an observer to its list public void AddObserver(Observer o) { obs_l.Add(o); } Then when you define your Notify function you will baasically pass a reference to the object calling, if it is ...



Top 50 recent answers are included