Game Development Community

What happens when a game object is removed but still in a list?

by John Klimek · in Torque X 2D · 09/01/2007 (10:53 am) · 0 replies

I haven't really used TorqueX (or XNA) yet, but I'm confused on one concept.

If I understand correctly, in XNA (and TorqueX) there are game objects. Each game object can represent _anything_ in a game (eg. an item, npc, player, etc). Game objects contain components that give the object it's functionality.

For example, an NPC game object might have an AI component but an item game object might have a LootContainer component.

Now, let's say the AI component needs to be updated every tick. When the component is created, it registers itself with the update manager (or whatever it is).

What happens when the AI component is removed?

Does TorqueX use the observer pattern so the AI component notifies the update manager before it is removed or how does that work?

Thanks for any help!