#region File Description //----------------------------------------------------------------------------- // Equipment.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework.Content; #endregion namespace RolePlayingGameData { /// /// Gear that may be equipped onto a FightingCharacter. /// public class Equipment : Gear { #region Owner Buff /// /// The statistics buff applied by this equipment to its owner. /// /// Buff values are positive, and will be added. private StatisticsValue ownerBuffStatistics = new StatisticsValue(); /// /// The statistics buff applied by this equipment to its owner. /// /// Buff values are positive, and will be added. [ContentSerializer(Optional=true)] public StatisticsValue OwnerBuffStatistics { get { return ownerBuffStatistics; } set { ownerBuffStatistics = value; } } #endregion #region Content Type Reader /// /// Read the Equipment type from the content pipeline. /// public class EquipmentReader : ContentTypeReader { /// /// Read the Equipment type from the content pipeline. /// protected override Equipment Read(ContentReader input, Equipment existingInstance) { Equipment equipment = existingInstance; if (equipment == null) { throw new ArgumentException( "Unable to create new Equipment objects."); } // read the gear settings input.ReadRawObject(equipment as Gear); // read the equipment settings equipment.OwnerBuffStatistics = input.ReadObject(); return equipment; } } #endregion } }