public Block MakeToSoilWithFarm(Block block) { var farmSpawn = Instantiate(farmSpawnTemplate, null, false); var farmBlock = MakeToSoilWith(block, farmSpawn); FarmMasterController.Get().IncreaseFarmCount(1); return(farmBlock); }
public bool CanSpawnAnotherHouse() { var bigHouses = _worldPlane.GetBlocksWithHouses().Where(houseBlock => houseBlock.GetOccupantHouse().IsBig()) .ToList(); var farms = FarmMasterController.Get().CountFarms(); var houses = _worldPlane.GetBlocksWithHouses(); return(houses.Count < (SelfSustainedHouses + (bigHouses.Count * 2) + (farms * 2))); }
private void SpawnMasterFarm(List <Block> houses) { var houseBlock = houses.OrderBy(_ => Random.value).First(); var lotToReplace = _worldPlane.GetNearbyVacantLotsStream(houseBlock.GetGridPosition()) .OrderBy(_ => Random.value) .FirstOrDefault(); if (lotToReplace != null) { FarmMasterController.Get().SetupFarmControllerForBlock(lotToReplace); _placedFirstFarm = true; } }
private void MasterFarmInteraction(GameObject other) { var vacantLot = other.gameObject.GetComponent <Block>(); FarmMasterController.Get().SetupFarmControllerForBlock(vacantLot); }