Exemplo n.º 1
0
 /// <summary>Creates a new <see cref="Unit"/> instance.
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="power">Power.</param>
 /// <param name="location">Location.</param>
 public Unit(UnitType type, Power power, Location location)
 {
     this.type = type;
     this.power = power;
     this.location = location;
     this.retreatLocations = new LocationCollection();
 }
Exemplo n.º 2
0
 /// <summary>Gets a value indicating whether a specific <see cref="Power"/> can build a specific <see cref="UnitType"/> on this <see cref="Province"/>
 /// </summary>
 /// <param name="power">Power</param>
 /// <param name="unitType">Unit type.</param>
 /// <returns><c>true</c> if the specified <see cref="Power"/> can build the specified <see cref="UnitType"/> on this <see cref="Province"/>; otherwise, <c>false</c>.</returns>
 public bool CanBuildUnitType(Power power, UnitType unitType)
 {
     switch(unitType)
     {
         case UnitType.Army :
             return CanBuild(power) && ArmyMoveable;
         case UnitType.Fleet :
             return CanBuild(power) && FleetMoveable;
         default :
             throw new ArgumentException(Properties.ErrorMessages.Province_UnknownUnitType, "unitType");
     }
 }
Exemplo n.º 3
0
 /// <summary>Gets a value indicating whether a specific <see cref="Power"/> can build a fleet on this <see cref="Province"/>
 /// </summary>
 /// <param name="power">Power</param>
 /// <returns><c>true</c> if the specified <see cref="Power"/> can build a fleet on this <see cref="Province"/>; otherwise, <c>false</c>.</returns>
 public bool CanBuildFleet(Power power)
 {
     return CanBuildUnitType(power, UnitType.Fleet);
 }
Exemplo n.º 4
0
 /// <summary>Gets a value indicating whether a specific <see cref="Power"/> can build an army on this <see cref="Province"/>
 /// </summary>
 /// <param name="power">Power</param>
 /// <returns><c>true</c> if the specified <see cref="Power"/> can build an army on this <see cref="Province"/>; otherwise, <c>false</c>.</returns>
 public bool CanBuildArmy(Power power)
 {
     return CanBuildUnitType(power, UnitType.Army);
 }
Exemplo n.º 5
0
 /// <summary>Gets a value indicating whether a specific power can build on this <see cref="Province"/>.
 /// </summary>
 /// <param name="power">Power.</param>
 /// <returns><c>true</c> if the power can build on this <see cref="Province"/>; otherwise, <c>false</c>.</returns>
 public bool CanBuild(Power power)
 {
     return IsOpenForBuilding && ( this.owningPower == power );
 }