Project Description
Xtengine makes it easier for XNA developers to develop in a compositional manner.
You'll no longer have to write specific game classes with deep hierarchies or hardcode to load levels. It's developed in C# with XNA 4.0, with WP7 in mind.

To use:

Create an instance of ComponentManager, optionally passing in additional Assembly objects that contain component types.
Example:
    AssemblyTunnel componentAssemblyTunnel = new AssemblyTunnel();
    Assembly[] componentAssemblies = new Assembly[] { componentAssemblyTunnel.Assembly };

    componentManager = new ComponentManager(componentAssemblies);

Create an interface and class pair for a component, tagging the class with an attribute.
Example:
    public enum TypeOfZombie
    {
        Infected,
        Mauled,
        Ravaged
    }

    public interface IZombieType : IXTengineComponent
    {
        TypeOfZombie Type { get; set; }
    }

    [XTengineComponent(typeof(IZombieType))]
    public class ZombieType : XTengineComponentBase, IZombieType
    {
        private TypeOfZombie type;

        void IXTengineComponent.Attach() { }

        void IXTengineComponent.Update() { }

        void IXTengineComponent.Detach() { }

        TypeOfZombie IZombieType.Type
        {
            get { return this.type; }
            set { this.type = value; }
        }
    }


From there you can create entities, add components, and add them to a save-able level.
Example:
    Level testLevel = new Level("TestLevel");
    testLevel.Load(componentManager); //if you have previously saved
    
    XTengineObject testZombie = new XTengineObject();
    IZombieType zombieTypeComponent = testZombie.AddComponent<IZombieType>();
    zombieTypeComponent.Type = TypeOfZombie.Mauled;

    testLevel.AddEntity(testZombie);
    testLevel.Save();

Last edited Nov 20, 2010 at 4:11 PM by ColesyM, version 2