namespace ElementalGame.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 DarkWynterEngine.GameObjects;
///
/// 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 UserDefinedTypes : GameObjectTypes
{
///
/// Create an GameObject using the "type" string included in the XmlNode.
/// GameObject must be included in Engine, or added using GameObject override in Game.
///
/// Xml data describing the Gameobject.
/// A blank GameObject to replace with User-Defined GameObject.
/// Returns true if GameObject was successfully created.
public override bool CreateGameObjectType(string type, ref GameObject gameObject)
{
// Create the GameObject based on type
switch (type)
{
case "Sky":
gameObject = new SkySphere();
return true;
case "Portal":
gameObject = new Portal();
return true;
default:
Console.WriteLine("Error Loading XML Object: " + type);
break;
}
return false;
}
}
}