| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //-----------------------------------------------------------------------------
- // Equipment.cs
- //
- // Microsoft XNA Community Game Platform
- // Copyright (C) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using Microsoft.Xna.Framework.Content;
- namespace RolePlaying.Data
- {
- /// <summary>
- /// Gear that may be equipped onto a FightingCharacter.
- /// </summary>
- public class Equipment : Gear
- {
- /// <summary>
- /// The statistics buff applied by this equipment to its owner.
- /// </summary>
- /// <remarks>Buff values are positive, and will be added.</remarks>
- private StatisticsValue ownerBuffStatistics = new StatisticsValue();
- /// <summary>
- /// The statistics buff applied by this equipment to its owner.
- /// </summary>
- /// <remarks>Buff values are positive, and will be added.</remarks>
- [ContentSerializer(Optional = true)]
- public StatisticsValue OwnerBuffStatistics
- {
- get { return ownerBuffStatistics; }
- set { ownerBuffStatistics = value; }
- }
- public static Equipment Load(string equipmentAssetName)
- {
- throw new NotImplementedException();
- }
- /// <summary>
- /// Read the Equipment type from the content pipeline.
- /// </summary>
- public class EquipmentReader : ContentTypeReader<Equipment>
- {
- /// <summary>
- /// Read the Equipment type from the content pipeline.
- /// </summary>
- 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<Gear>(equipment as Gear);
- // read the equipment settings
- equipment.OwnerBuffStatistics = input.ReadObject<StatisticsValue>();
- return equipment;
- }
- }
- }
- }
|