//----------------------------------------------------------------------------- // GearDrop.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- using System; using Microsoft.Xna.Framework.Content; namespace RolePlaying.Data { /// /// Description of how often a particular gear drops, typically from a Monster. /// public class GearDrop { /// /// The content name of the gear. /// private string gearName; /// /// The content name of the gear. /// public string GearName { get { return gearName; } set { gearName = value; } } /// /// The percentage chance that the gear will drop, from 0 to 100. /// private int dropPercentage; /// /// The percentage chance that the gear will drop, from 0 to 100. /// public int DropPercentage { get { return dropPercentage; } set { dropPercentage = (value > 100 ? 100 : (value < 0 ? 0 : value)); } } /// /// Read a GearDrop object from the content pipeline. /// public class GearDropReader : ContentTypeReader { protected override GearDrop Read(ContentReader input, GearDrop existingInstance) { GearDrop gearDrop = existingInstance; if (gearDrop == null) { gearDrop = new GearDrop(); } gearDrop.GearName = input.ReadString(); gearDrop.DropPercentage = input.ReadInt32(); return gearDrop; } } } }