Train Defense 2‎ > ‎

Push Out Manager

posted Jul 9, 2012, 9:32 AM by James Podesta   [ updated Jul 10, 2012, 11:04 PM ]
Tonight I ported the push out manager from Train Defense to Unity. Most of the port just involves syntactic changes from C++ to C#.  Pretty much everything that moves to C# just ends up looking cleaner and simpler. All the fancy systems I had in place to handle AI talking to the propulsion system of objects has been replaced by simple Unity component scripts. The data file that used to describe all the enemies is now replaced by variables on the enemy prefabs, making it much more flexible and faster to develop.

Suffice to say the conversion to Unity has been a win on every front so far. The only think Unity can do to hurt me will be performance and so far that has been quite acceptable. Even the debug code for the Push Out Manager is simpler and cleaner now. What was a page long iteration of structures and calls to debug renderers, is now a simple foreach() with a call to gizmo drawSphere.

Each enemy now has a PushOutObject component which caches all the information the pushout system needs to keep objects outside of each other. A LateUpdate on the PushOutManager resolves all collisions and pushes the objects outside of each other.

There is still no AI, other than a desire to go to 0,0,0. AI is trivial to write, so I'll leave that a bit longer. I still have a lot of systems to port, and it will probably take a night to port each one, though I know a lot more Unity now so I'm spending a lot less time searching through Unity Forums.

Train Defense 2 - Prototype 003