|
![](/i/fill.gif) |
Invisible wrote:
> Darren New wrote:
>
>> Actually, I think that clued me in a bit. They *are* all of type
>> "object". ;-)
>>
>> So I could just have a list of objects, and when I get an update,
>> (dynamic)-cast each element to a IUpdatable and invoke that if it
>> works; when I get a draw, cast each to an IDrawable and invoke that if
>> it works, etc.
>>
>> Ugly, but it'll do the trick, I think.
>
> Ah yes, ye olde "upcast everything to Object" antipattern. :-D
Well, it gives me the advantage that I could use the same container as a
"service provider." So as soon as you create something that inherits from
a specific interface, you can also retrieve that thing from other
components. This should work out better with what I'm trying to do, which
is more a scene manager (opening screen, start menu, options menu, game,
high-score list, cutscenes, etc) than a single-screen game. The services
manager that comes with XNA is tied to the overall game, meaning you
couldn't have (say) different gamepad managers or different cameras for the
different sections.
But yeah, it would be a generic bag'o'objects, which is certainly not the
best way of doing things.
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.gameservicecontainer.getservice.aspx
--
Darren New, San Diego CA, USA (PST)
Yes, we're traveling together,
but to different destinations.
Post a reply to this message
|
![](/i/fill.gif) |