Beispiel #1
0
 private void ResetWorld()
 {
     _worldPlane.ResetAtSize(WorldPlane.Size.Large);
     FarmMasterController.OnResetWorld();
     OnBeforeDestroy();
     Destroy(gameObject);
 }
    public Block MakeToSoilWithFarm(Block block)
    {
        var farmSpawn = Instantiate(farmSpawnTemplate, null, false);
        var farmBlock = MakeToSoilWith(block, farmSpawn);

        FarmMasterController.Get().IncreaseFarmCount(1);

        return(farmBlock);
    }
Beispiel #3
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)));
    }
    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 Awake()
 {
     _farmMasterControllerInstance = this;
 }
Beispiel #6
0
    private void MasterFarmInteraction(GameObject other)
    {
        var vacantLot = other.gameObject.GetComponent <Block>();

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