Mercurial > repos > snowblizz-super-API-ideas
diff api/Objects/UnitType.cs @ 46:a5855fcd75ab
Re #11 - Document classes and methods
* Document methods in UnitType and Category classes
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 23 Mar 2009 20:57:07 +0000 |
parents | 548cfc776f54 |
children | 9561ef46c6fb |
line wrap: on
line diff
--- a/api/Objects/UnitType.cs Mon Mar 23 20:21:41 2009 +0000 +++ b/api/Objects/UnitType.cs Mon Mar 23 20:57:07 2009 +0000 @@ -12,7 +12,7 @@ namespace IBBoard.WarFoundry.API.Objects { /// <summary> - /// Summary description for Unit. + /// A UnitType is a type for a <see cref=" Unit"/>, normally relating to an entry in an army list. The UnitType defines the name, cost, minimum and maximum limits of a unit, and the equipment units of the type can take. /// </summary> public class UnitType : WarFoundryObject { @@ -52,12 +52,18 @@ AddRequirement(requirement); } } - + + /// <value> + /// Gets the <see cref=" Race"/> that this unit belongs to. + /// </value> public Race Race { get { return race; } } - + + /// <value> + /// Gets or sets the <see cref=" Category"/> that this unit type is a member of. + /// </value> public virtual Category MainCategory { get @@ -69,7 +75,10 @@ mainCat = value; } } - + + /// <value> + /// Gets or sets the minimum size of each unit of this type. Note: This should be set AFTER MaxSize, otherwise an unintended default value may be set for the minimum + /// </value> public int MinSize { get { return minSize; } @@ -79,7 +88,10 @@ CheckMinimumSize(); } } - + + /// <value> + /// Gets or sets the maximum size of each unit of this type. Note: This should be set BEFORE MinSize, otherwise an unintended default value may be set for the minimum + /// </value> public int MaxSize { get { return maxSize; } @@ -89,12 +101,10 @@ CheckMinimumSize(); } } - - public int BaseSize - { - get { return baseSize; } - } - + + /// <value> + /// Gets or sets the minimum number of units of this type that must be taken in an army. Note: This should be set AFTER MaxNumber, otherwise an unintended default value may be set for the minimum + /// </value> public int MinNumber { get { return min; } @@ -104,7 +114,10 @@ CheckMinimumNumber(); } } - + + /// <value> + /// Gets or sets the maximum number of units of this type that can be taken in an army. Note: This should be set BEFORE MinNumber, otherwise an unintended default value may be set for the minimum + /// </value> public int MaxNumber { get { return max; } @@ -114,7 +127,10 @@ CheckMinimumNumber(); } } - + + /// <summary> + /// Makes sure that the minimum number isn't more than the maximum number, hence the warning on the properties + /// </summary> private void CheckMinimumNumber() { if (MinNumber > MaxNumber && MaxNumber!=WarFoundryCore.INFINITY) @@ -123,7 +139,10 @@ LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum number greater than their maximum number.", Name, ID); } } - + + /// <summary> + /// Makes sure that the minimum unit size isn't more than the maximum unit size, hence the warning on the properties + /// </summary> private void CheckMinimumSize() { if (MinSize > MaxSize && MaxSize!=WarFoundryCore.INFINITY) @@ -133,12 +152,27 @@ } } + //// <value> + /// Gets or sets the "base size" of a unit, which is the number of troopers the unit has in it for its "base cost". For a lot of units this value will be 0 as the cost is worked out based on the total number of members. + /// </value> + public int BaseSize + { + get { return baseSize; } + set { baseSize = (value >= 0 ? value : 0); } + } + + /// <value> + /// The number of points that a "base unit" of <code>BaseSize</code> models costs. Additional models are charged at <code>CostPerTrooper</code> each. + /// </value> public double BaseUnitCost { get { return baseUnitCost; } set { baseUnitCost = (value >= 0 ? value : 0); } } - + + //// <value> + /// The cost of an individual trooper. This value is the cost for a basic trooper without weapons, which are added on top of the cost before calculating a unit cost. + /// </value> public double CostPerTrooper { get { return costPerTrooper; } @@ -149,7 +183,10 @@ { throw new InvalidOperationException("Unit type with id "+id+" did not have a name specified"); } - + + /// <value> + /// The <see cref=" Stats"/> for the unit in a format that is valid for the game system. + /// </value> public Stats UnitStats { get @@ -164,12 +201,27 @@ } } } - + + /// <summary> + /// Gets a <see cref="UnitEquipmentItem"/> for the given ID string, or <code>null</code> if nothing exists for that ID + /// </summary> + /// <param name="id"> + /// The ID of the UnitEquipmentItem to get + /// </param> + /// <returns> + /// The <see cref="UnitEquipmentItem"/> for the given ID string, or <code>null</code> if nothing exists for that ID + /// </returns> public UnitEquipmentItem GetEquipmentItem(string id) { return (UnitEquipmentItem)equipment[id]; } - + + /// <summary> + /// Gets an array of all available <see cref="UnitEquipmentItem"/>s for this UnitType + /// </summary> + /// <returns> + /// An array of all available <see cref="UnitEquipmentItem"/>s for this UnitType + /// </returns> public UnitEquipmentItem[] GetEquipmentItems() { UnitEquipmentItem[] items = new UnitEquipmentItem[equipment.Count];