Beispiel #1
0
 public function ensureBehaviors()
 {
     parent::ensureBehaviors();
     if (!$this->behaviorsEnsured) {
         $this->behaviorsEnsured = true;
         $buildingGroupBehaviors = $this->getBuildingGroupBehaviors($this->getGroup());
         $this->attachBehaviors($buildingGroupBehaviors);
     }
 }
Beispiel #2
0
 /**
  * Remove resources needed to construct a building from this base.
  * 
  * @param Building $building
  * @param float $factor
  */
 public function payFor($building, $factor = 1.0)
 {
     // Make the factor negative. We want to substract the costs.
     $factor *= -1;
     $this->updateCounters(['stored_chemicals' => $factor * $building->getCostChemicals(), 'stored_credits' => $factor * $building->getCostCredits(), 'stored_energy' => $factor * $building->getCostEnergy(), 'stored_ice' => $factor * $building->getCostIce(), 'stored_iron' => $factor * $building->getCostIron(), 'stored_people' => $factor * $building->getCostPeople(), 'stored_steel' => $factor * $building->getCostSteel(), 'stored_vv4a' => $factor * $building->getCostVv4a(), 'stored_water' => $factor * $building->getCostWater()]);
 }