#region File Description
//-----------------------------------------------------------------------------
// FixedCombat.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Xna.Framework.Content;
#endregion
namespace RolePlayingGameData
{
///
/// The description of a fixed combat encounter in the world.
///
public class FixedCombat : WorldObject
{
///
/// The content name and quantities of the monsters in this encounter.
///
private List> entries = new List>();
///
/// The content name and quantities of the monsters in this encounter.
///
public List> Entries
{
get { return entries; }
set { entries = value; }
}
#region Content Type Reader
///
/// Reads a FixedCombat object from the content pipeline.
///
public class FixedCombatReader : ContentTypeReader
{
///
/// Reads a FixedCombat object from the content pipeline.
///
protected override FixedCombat Read(ContentReader input,
FixedCombat existingInstance)
{
FixedCombat fixedCombat = existingInstance;
if (fixedCombat == null)
{
fixedCombat = new FixedCombat();
}
input.ReadRawObject(fixedCombat as WorldObject);
fixedCombat.Entries.AddRange(
input.ReadObject>>());
foreach (ContentEntry fixedCombatEntry in fixedCombat.Entries)
{
fixedCombatEntry.Content = input.ContentManager.Load(
Path.Combine(@"Characters\Monsters",
fixedCombatEntry.ContentName));
}
return fixedCombat;
}
}
#endregion
}
}