/** * 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()]); }