shanestevens
|
 |
« on: October 09, 2011, 03:41:53 » |
|
I have a WorldProxy. The WorldProxy is responsible for managing WorldObjects, that includes their spatial structure, their lifetimes, their current state, and is also responsible for updating all of them at a set interval. This all ticks, excuse the pun, along nicely.
When it comes to rendering the objects, I have a WorldMediator which uses the database held in the WorldProxy. It takes care of visibility, a camera, all the stuff that's render related.
Historically, all of my WorldObjects would have a tick() and a render(). Currently they have a tick(), which is what makes everything work, however, I can't have a class that has one foot in the Model layer, and the other in the View layer.
The trouble is, the WorldObject really should render itself, because it knows about its internal state, which assets belong to it, etc. If I had a separate class to render the WorldObject, it would be an outsider looking in, breaking encapsulation.
The only other way I can think of doing this, the PureMVC way, is to have the WorldProxy do nothing except hold the state data, then have the spatial structure held in the WorldMediator. This feels wrong to me though, given the role of the Model in my case is to be a database.
How is this dual life usually handled in PureMVC?
- Shane
|