private void Start() { _sandSpreadController = SandSpreadController.Get(); _worldPlane = WorldPlane.Get(); _block = GetComponentInChildren <Block>(); _featureToggles = FeatureToggles.Get(); }
void Update() { if (FeatureToggles.Get().predators) { MaybePopulate(); } }
protected void Start() { _originalLocalPosition = transform.localPosition; _originalScale = transform.localScale * 1.5f; transform.localScale = _originalScale; _featureToggles = FeatureToggles.Get(); _worldPlane = WorldPlane.Get(); if (isStartingInteractor) { GetComponentInParent <BlockInteractionPalette>().Select(this); Activate(); } _ghost = Instantiate(BlockFactory.Get().interactableGhostTemplate); _ghost.SetActive(false); _nonInteractableGhost = Instantiate(BlockFactory.Get().nonInteractableGhostTemplate); _nonInteractableGhost.SetActive(false); _started = true; }
void Start() { if (FeatureToggles.Get().persons) { Populate(); } }
void Start() { _worldPlane = GetComponent <WorldPlane>(); _lastPlacedHouse = Time.fixedTime - 10; _sandSpreadController = SandSpreadController.Get(); _featureToggles = FeatureToggles.Get(); _workQueue = WorkQueue.Get(); }
public bool CanBeDugAsAnIndependentBlock() { if (FeatureToggles.Get().desertsAreBeaches) { return(IsGrass() || IsSand()); } else { return(IsGrass()); } }
public bool IsLot() { if (FeatureToggles.Get().desertsAreBeaches) { return(IsGrass() || IsSand()); } else { return(IsGrass()); } }
public override void Interact(GameObject other) { var blockComponent = other.gameObject.GetComponent <Block>(); if (blockComponent.IsSand()) { if (!FeatureToggles.Get().desertsAreBeaches) { InhabitBlock(blockComponent, desertGreensTemplate); } } else if (blockComponent.IsGrass()) { InhabitBlock(blockComponent, greensBlockTemplate); } }
void Update() { if (!FeatureToggles.Get().woodcutters) { return; } if (Random.value < .01f) { var houseCount = _worldPlane.GetBlocksWithHouses().Count; if (houseCount < 3) { return; } var woodcutters = _worldPlane.GetBlocksWithWoodcutters().Count(); var woodcutterToHouseRatio = (float)Mathf.Max(woodcutters, 1) / (float)houseCount; if (woodcutterToHouseRatio > .1f) { return; } var greensAndVacantLot = _worldPlane .GetBlocksWithGreens() .SelectMany(block => { return(_worldPlane .GetNearbyVacantLots(block.GetGridPosition()) .Select(vacantLot => new Tuple <Block, Block>(block, vacantLot))); }) .OrderBy(_ => Random.value) .FirstOrDefault(); if (greensAndVacantLot != null) { SpawnWoodcutter(greensAndVacantLot); } } if (_hasUnfulfilledRequestToStoreWood) { _hasUnfulfilledRequestToStoreWood = false; SpawnStockpile(); } }
private bool CanDig(Block blockComponent) { if (FeatureToggles.Get().digAnywhere) { return(blockComponent && blockComponent.CanBeDugAsAnIndependentBlock() && blockComponent.IsTopBlockInStack() && blockComponent.IsVacant() && !blockComponent.IsLowestLevel()); } else { return(blockComponent && blockComponent.CanBeDugAsAnIndependentBlock() && blockComponent.IsGroundLevel() && blockComponent.IsVacant()); } }
private void Update() { if (!FeatureToggles.Get().biomes) { return; } if (Input.GetKeyDown(KeyCode.Alpha1)) { BlockHighlighter.Highlight(_biomes[0].GetBlocks()); } if (Input.GetKeyDown(KeyCode.Alpha2)) { BlockHighlighter.Highlight(_biomes[1].GetBlocks()); } if (Input.GetKeyDown(KeyCode.Alpha3)) { BlockHighlighter.Highlight(_biomes[2].GetBlocks()); } if (Input.GetKeyDown(KeyCode.Alpha4)) { BlockHighlighter.Highlight(_biomes[3].GetBlocks()); } if (Input.GetKeyDown(KeyCode.Space)) { EstablishBiomePerk(); } return; if (_delta > 2 * 60) { EstablishBiomePerk(); _delta = 0; } _delta += Time.deltaTime; }
void Start() { _worldPlane = WorldPlane.Get(); _workQueue = WorkQueue.Get(); _featureToggles = FeatureToggles.Get(); }
private void TrySpawnBoat() { if (_boatCount == 1 && Random.value > .1f) { return; } if (_boatCount == 2 && Random.value > .05f) { return; } if (_boatCount == 3 && Random.value > .01f) { return; } if (_boatCount == 4 && Random.value > .001f) { return; } if (_boatCount == 5 && Random.value > .0001f) { return; } if (_boatCount == 6 && Random.value > .00001f) { return; } if (_boatCount == 7 && Random.value > .000001f) { return; } if (_boatCount == 8 && Random.value > .0000001f) { return; } if (_boatCount == 9 && Random.value > .00000001f) { return; } if (FeatureToggles.Get().woodcutters) { var cityWood = CityWoodcutters.Get(); if (!cityWood.RequireWood(BoatCost)) { return; } cityWood.ConsumeWood(BoatCost); } var waterBlock = _worldPlane.GetWaterBlocks() .Where(block => { var blockPosition = block.GetGridPosition(); return(block.IsGroundLevel() && _worldPlane.GetBlocksWithDocks() .Any(dock => Vector3.Distance(dock.GetGridPosition(), blockPosition) < 3f)); }) .OrderBy(_ => Random.value) .First(); var boat = Instantiate(boatTemplate); var boatPosition = _worldPlane.ToRealCoordinates(waterBlock.GetGridPosition()); boatPosition.y = 1.164f; boat.transform.position = boatPosition; _boatCount += 1; }
private void Start() { _featureToggles = FeatureToggles.Get(); }
private void Awake() // FarmController is only created during the game, and is used right after being created. Therefore we must store static instances in the Awake method instead of Start. { _worldPlane = WorldPlane.Get(); _featureToggles = FeatureToggles.Get(); }