public function PurchaseBuildings(array $resources, $firstItem) { $colony = $this->User()->CurrentColony(); $buildGroup = BuildingBuildGroup::FromList($resources, $colony); $rb = new ResourceBuilder($buildGroup); $rb->BuildList()->AddToDatabase(); if ($firstItem) { $rb->BuildList()->UpdateCommissionedTime(); } }
private function ConstructBuilding(ResourceBuilder $rb) { if (count($rb->BuildList()->Members()) == 0) { return true; } // Nothing to do here // Get the first item on the list $unit = reset($rb->BuildList()->Members()); echo "<br/>Unit about to be built: "; echo $unit; // Construct it (database is updated within) return $unit->Construct(); }