Пример #1
0
    public Block MakeToSoilWithFarm(Block block)
    {
        var farmSpawn = Instantiate(farmSpawnTemplate, null, false);
        var farmBlock = MakeToSoilWith(block, farmSpawn);

        FarmMasterController.Get().IncreaseFarmCount(1);

        return(farmBlock);
    }
Пример #2
0
    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)));
    }
Пример #3
0
    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;
        }
    }
Пример #4
0
    private void MasterFarmInteraction(GameObject other)
    {
        var vacantLot = other.gameObject.GetComponent <Block>();

        FarmMasterController.Get().SetupFarmControllerForBlock(vacantLot);
    }