コード例 #1
0
  public UnitImpl produceUnit() {
    hasProduced += 1;
    treasury -= productionCost;

    return unitProductionStrategy.produceUnit(ownedBy);
  }
コード例 #2
0
 public void setProduction(String typeOfProduction) {
   this.typeOfProduction = typeOfProduction;
   unitProductionStrategy = new UnitFactory().createUnitStrategy(typeOfProduction);
   productionCost = unitProductionStrategy.getCost();
 }