Xml Reader Output

The followingarticle provides good information about this:

http://www.ziggyware.com/readarticle.php?article_id=150


XML Reader Class

To Read List of Content: Will need to define XML <Asset Type= " "> to System.Collections.Generic.List[(ProjectName).(ItemTypeClass).

ItemTypeClass will need be a specific class defining the objects to be brought in, and other important information such as location, hit points, etc etc.

An example below is of a Sprite:

public class Sprite
{
    Vector2 position;
    float rotation;
    Vector2 scale;

    string textureAsset;
    Texture2D texture;

    public Vector2 Position
    {
        get { return position; }
        set { position = value; }
    }

    public float Rotation
    {
        get { return rotation; }
        set { rotation = value; }
    }

    public Vector2 Scale
    {
        get { return scale; }
        set { scale = value; }
    }

    public string TextureAsset
    {
        get { return textureAsset; }
        set { textureAsset = value; }
    }

    [ContentSerializerIgnore]
    public Texture2D Texture
    {
        get { return texture; }
    }

    public void Load(ContentManager content)
    {
        texture = content.Load<Texture2D>(textureAsset);
    }

    public void Draw(SpriteBatch batch)
    {
        batch.Draw(
            texture, 
            position, 
            null,
            Color.White, 
            rotation, 
            Vector2.Zero,
            scale,
            SpriteEffects.None, 
            0f);
    }
}

XML Object Types

Level Geometry

Static Meshes

Triggers

Volumes

Particle Effects

Creatures

Waypoints

Sounds

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License