using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using System.IO;
using System.Reflection;
namespace Brains.Framework
{
///
/// Represents the main AI Engine.
/// Create an instance of this class and call update every frame to stimulate the world
///
public class AIEngine
{
private World _world;
internal List Assemblies = new List();
///
/// The main game world
///
public World World { get { return _world; } }
///
/// Default Constructor
///
public AIEngine()
{
}
///
/// The main engine update method
///
/// The GameTime elapsed since the last update
/// Call this every frame
public void Update(GameTime gameTime)
{
World.Update(gameTime);
}
///
/// Creates an empty world
///
public void CreateWorld()
{
_world = new World();
_world.Engine = this;
}
///
/// Sets the world to the specified world
///
/// The world to set as the active world
/// Can be used when extending the World class
public void CreateWorld(World world)
{
_world = world;
_world.Engine = this;
}
///
/// Loads an assembly ready for use with loading from file.
///
/// The full file path of the assembly
/// Will automatically load the engine assembly if not already loaded
public void LoadAssembly(string path)
{
if (Assemblies.Count == 0)
{
Assemblies.Add(typeof(AIEngine).Assembly);// Assembly.LoadFrom(typeof(AIEngine).Assembly.Location));
}
//Cache all the assemblies
Assemblies.Add(Assembly.LoadFrom(path));
}
}
}