#region File Description
//-----------------------------------------------------------------------------
// Portal.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
{
///
/// A transition point from one map to another.
///
public class Portal : 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 Landing Data
///
/// The map coordinate that the party will automatically walk to
/// after spawning on this portal.
///
private Point landingMapPosition;
///
/// The map coordinate that the party will automatically walk to
/// after spawning on this portal.
///
public Point LandingMapPosition
{
get { return landingMapPosition; }
set { landingMapPosition = value; }
}
#endregion
#region Destination Map Data
///
/// The content name of the map that the portal links to.
///
private string destinationMapContentName;
///
/// The content name of the map that the portal links to.
///
public string DestinationMapContentName
{
get { return destinationMapContentName; }
set { destinationMapContentName = value; }
}
///
/// The name of the portal that the party spawns at on the destination map.
///
private string destinationMapPortalName;
///
/// The name of the portal that the party spawns at on the destination map.
///
public string DestinationMapPortalName
{
get { return destinationMapPortalName; }
set { destinationMapPortalName = value; }
}
#endregion
#region Content Type Reader
///
/// Reads a Portal object from the content pipeline.
///
public class PortalReader : ContentTypeReader
{
protected override Portal Read(ContentReader input,
Portal existingInstance)
{
Portal portal = existingInstance;
if (portal == null)
{
portal = new Portal();
}
portal.AssetName = input.AssetName;
portal.Name = input.ReadString();
portal.LandingMapPosition = input.ReadObject();
portal.DestinationMapContentName = input.ReadString();
portal.DestinationMapPortalName = input.ReadString();
return portal;
}
}
#endregion
}
}