#region File Description
//-----------------------------------------------------------------------------
// WorldObject.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
#endregion
namespace RolePlayingGameData
{
///
/// Common base class for all objects that are visible in the world.
///
public abstract class WorldObject : ContentObject
{
#region Description
///
/// The name of the object.
///
private string name;
///
/// The name of the object.
///
public string Name
{
get { return name; }
set { name = value; }
}
#endregion
#region Content Type Reader
///
/// Read a WorldObject object from the content pipeline.
///
public class WorldObjectReader : ContentTypeReader
{
///
/// Read a WorldObject object from the content pipeline.
///
protected override WorldObject Read(ContentReader input,
WorldObject existingInstance)
{
// we cannot create this object, so there must be an existing instance
if (existingInstance == null)
{
throw new ArgumentNullException("existingInstance");
}
existingInstance.AssetName = input.AssetName;
existingInstance.Name = input.ReadString();
return existingInstance;
}
}
#endregion
}
}