Mercurial > repos > IBBoard.WarFoundry.API
comparison API/Objects/Requirement/UnitCountRequirementData.cs @ 444:206a45fdfa9e
Re #350: Add requirement to allow N of unit for specific other units
* Extend N for M requirement to start handling multiple unit types in an additive method
* Extend requirement data object to handle multiple unit types
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 07 Dec 2011 21:01:33 +0000 |
parents | 0922851f6125 |
children |
comparison
equal
deleted
inserted
replaced
443:86725e88052e | 444:206a45fdfa9e |
---|---|
6 | 6 |
7 namespace IBBoard.WarFoundry.API.Objects.Requirement | 7 namespace IBBoard.WarFoundry.API.Objects.Requirement |
8 { | 8 { |
9 public class UnitCountRequirementData | 9 public class UnitCountRequirementData |
10 { | 10 { |
11 private UnitType unitType; | 11 private UnitType[] unitTypes; |
12 private int count; | 12 private int count; |
13 private int allows; | 13 private int allows; |
14 | 14 |
15 public UnitCountRequirementData(UnitType unitType, int count) : this(unitType, count, WarFoundryCore.INFINITY) | 15 public UnitCountRequirementData(UnitType unitType, int count) : this(unitType, count, WarFoundryCore.INFINITY) |
16 { | 16 { |
17 //Do nothing special | 17 //Do nothing special |
18 } | 18 } |
19 | 19 |
20 public UnitCountRequirementData(UnitType unitType, int count, int allows) | 20 public UnitCountRequirementData(UnitType unitType, int count, int allows) : this(new UnitType[]{unitType}, count, allows) |
21 { | 21 { |
22 this.unitType = unitType; | 22 //Do nothing special |
23 } | |
24 | |
25 public UnitCountRequirementData(UnitType[] unitTypes, int count) : this(unitTypes, count, WarFoundryCore.INFINITY) | |
26 { | |
27 //Do nothing special | |
28 } | |
29 | |
30 public UnitCountRequirementData(UnitType[] unitTypes, int count, int allows) | |
31 { | |
32 this.unitTypes = unitTypes ?? new UnitType[0]; | |
23 this.count = count; | 33 this.count = count; |
24 this.allows = allows; | 34 this.allows = allows; |
25 } | 35 } |
26 | 36 |
27 public UnitType UnitType | 37 public UnitType UnitType |
28 { | 38 { |
29 get { return unitType; } | 39 get { return unitTypes.Length > 0 ? unitTypes[0] : null; } |
40 } | |
41 | |
42 public UnitType[] UnitTypes | |
43 { | |
44 get { return unitTypes; } | |
30 } | 45 } |
31 | 46 |
32 public int Count | 47 public int Count |
33 { | 48 { |
34 get { return count; } | 49 get { return count; } |