Lawrence Posted January 30, 2016 Share Posted January 30, 2016 For example if I keep the display objects in this structure: A contains B contains C contains D I have a controller X that has a reference of A. Then X wants to react to signals dispatched from D, but I don't want X to directly interact with D. And I want each layer to only deal with their immediate child objects. It seems the only pattern I can do is to have the events propagate one level each time. e.g. in different places I will have to do: d.events.onFooD = new Phaser.Signal(); c.events.onFooC = d.events.onFooD; b.events.onFooB = c.events.onFooC; a.events.onFooA = b.events.onFooB; Then in X: a.events.onFooA.add(function(){ }); Is that a correct approach? Link to comment Share on other sites More sharing options...
Recommended Posts