Exemple #1
0
    void Update()
    {
        if (!CanWorkThisFrame())
        {
            return;
        }

        if (_featureToggles.houseSpawn)
        {
            var delta = Time.fixedTime - _lastPlacedHouse;
            if (delta > 10f && Random.value < .1f)
            {
                if (CanSpawnAnotherHouse())
                {
                    SpawnOneHouse();
                }
            }

            var innerCityDelta = Time.fixedTime - _lastPlacedInnerCityHouse;
            if (innerCityDelta > 10f && Random.value < .2f)
            {
                if (Random.value < .1f)
                {
                    SpawnInnerCityHouse();
                }
            }
        }


        if (Random.value < .01f && HasNoOtherBigHouses())
        {
            SpawnBigHouse();
        }

        if (!_featureToggles.desertsAreBeaches)
        {
            if (!_sandSpawned
                ? Random.value < _sandSpreadController.startingThreshold
                : Random.value < _sandSpreadController.continuationThreshold)
            {
                var houseCount = _worldPlane.GetBlocksWithHouses().Count;
                if (houseCount > _sandSpreadController.houseCountThreshold)
                {
                    if (_worldPlane.CountBlocksOfType(Block.BlockType.Sand) == 0)
                    {
                        SpawnSandBlock();
                        _sandSpawned = true;
                    }
                }
            }
        }
    }