namespace DarkWynter.Engine.GameObjects { #region Using Statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using System.Xml; using System.Diagnostics; #endregion using Init; using Globals; /// /// User-Defined types can be added to the engine by inheriting from GameObjectTypes /// and overloading it's CreateGameobjectType method. This method must create a new /// GameObject and assign it to the incoming GameObject. Creation of the GameObject /// by the overloaded User-Defined class should use a case statement to decide what /// kind of GameObject to create based on the Xml-based "type" parameter. /// public class GameObjectTypes { /// /// Create an GameObject using the "type" string included in the XmlNode. /// /// Xml data describing the Gameobject. /// A blank GameObject to replace with User-Defined GameObject. /// Returns true if GameObject was successfully created. public virtual bool CreateGameObjectType(ref GameObject gameObject) { // Get the Object Type string type = gameObject.load.node.LocalName; // Create the GameObject based on type switch (type) { case "Terrain": gameObject = new Terrain(gameObject.load); return true; case "Prop": gameObject = new Prop(gameObject.load); return true; case "GpuObject": gameObject = new GpuObject(gameObject.load); return true; default: // Console.WriteLine("Error Loading XML Object: " + type); break; } return false; } } }