Mercurial > repos > IBBoard.WarFoundry.API
view api/Objects/UnitAbility.cs @ 56:9561ef46c6fb
Re #61 - Complete structure of WarFoundry API objects
* Add adding of abilities and equipment to UnitType
* Add getting of all, required and optional abilities
* Add UnitAbility class to store UnitType's reference to Ability object
Also:
* Convert UnitType to using Genericed collections
* Reduce visibility of properties to private
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 05 Apr 2009 19:57:32 +0000 |
parents | |
children |
line wrap: on
line source
// This file (UnitAbility.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. // using System; namespace IBBoard.WarFoundry.API.Objects { public class UnitAbility : WarFoundryObject { private Ability ability; private bool isRequired; public UnitAbility(Ability ability) { this.ability = ability; } public Ability Ability { get { return ability; } } public bool IsRequired { get { return isRequired; } set { isRequired = value; } } public override int GetHashCode () { return typeof(UnitAbility).GetHashCode() + ability.GetHashCode(); } public override bool Equals (object obj) { bool equal = true; if (obj == this) { equal = true; } else if (obj != null && GetType().Equals(obj.GetType())) { UnitAbility other = (UnitAbility)obj; if (!Ability.Equals(other.Ability)) { equal = false; } else if (IsRequired != other.IsRequired) { equal = false; } } else { equal = false; } return equal; } } }