예제 #1
0
파일: Unit.cs 프로젝트: evandrix/DAIDE10
 /// <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();
 }
예제 #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");
     }
 }
예제 #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);
 }
예제 #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);
 }
예제 #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 );
 }