comparison api/Objects/Unit.cs @ 123:52e8c3cdde10

Re #127: Unit creation always assigns default equipment * Add and use new constructor for Unit that doesn't assign default values Re #54: Add Army support to WarFoundryFactory * Load unit name and unit size
author IBBoard <dev@ibboard.co.uk>
date Mon, 24 Aug 2009 19:30:19 +0000
parents 2f3cafb69799
children c60fd5664698
comparison
equal deleted inserted replaced
122:571eee2b7b30 123:52e8c3cdde10
26 public event IntValChangedDelegate UnitSizeChanged; 26 public event IntValChangedDelegate UnitSizeChanged;
27 public event DoubleValChangedDelegate UnitEquipmentAmountChanged; 27 public event DoubleValChangedDelegate UnitEquipmentAmountChanged;
28 28
29 public Unit(UnitType unitType, ArmyCategory parentArmyCat) : this(unitType, unitType.MinSize, parentArmyCat) { } 29 public Unit(UnitType unitType, ArmyCategory parentArmyCat) : this(unitType, unitType.MinSize, parentArmyCat) { }
30 30
31 public Unit(UnitType unitType, int startSize, ArmyCategory parentArmyCat) 31 public Unit(UnitType unitType, int startSize, ArmyCategory parentArmyCat) : this("", "", startSize, unitType, parentArmyCat)
32 {
33 SetInitialEquipment();
34 }
35
36 public Unit(string id, string name, int startSize, UnitType unitType, ArmyCategory parentArmyCat) : base(id, name)
32 { 37 {
33 Category = parentArmyCat; 38 Category = parentArmyCat;
34 type = unitType; 39 type = unitType;
35 Size = startSize; 40 Size = startSize;
36 SetInitialEquipment();
37 CalcCost(); 41 CalcCost();
38 UnitEquipmentAmountChanged+= new DoubleValChangedDelegate(UnitEquipmentAmountChangedHandler); 42 UnitEquipmentAmountChanged+= new DoubleValChangedDelegate(UnitEquipmentAmountChangedHandler);
39 UnitSizeChanged+= new IntValChangedDelegate(UnitSizeChangedHandler); 43 UnitSizeChanged+= new IntValChangedDelegate(UnitSizeChangedHandler);
40 } 44 }
41 45