public void DisplayWoodGatherUI(Vector3 position, int amount) { Vector3 noise = Alea.GetFloat(0.2f, 1.0f) * Vector3.up; GameObject obj = Instantiate(_woodGatherTemplate, position + noise, Quaternion.identity, transform); obj.GetComponentInChildren <TextMeshProUGUI>().text = "+ " + amount + " wood"; }
private void GenerateRandomWaypoints(int number) { for (int i = 0; i < number; i++) { Waypoint newWaypoint = Instantiate(_waypointTemplate, Vector3.zero, Quaternion.identity, transform); newWaypoint.transform.localPosition = new Vector3(Alea.GetFloat(-5.0f, 5.0f), 0.0f, Alea.GetFloat(-5.0f, 5.0f)); _waypoints.Add(newWaypoint); } }
private void CreateTree(Vector2Int position) { float noiseX = Alea.GetFloat(0.0f, noise); float noiseZ = Alea.GetFloat(0.0f, noise); Vector3 pos = new Vector3((position.x + noiseX - _numberSteps) * stepSize, 0.0f, (position.y + noiseZ - _numberSteps) * stepSize); Tree tree = GenerateTree(pos); _createdTrees.Add(new Vector2Int(position.x, position.y), tree); }
public void GenerateRandomTrees() { _createdTrees = new Dictionary <Vector2Int, Tree>(); if (density == 0.0f) { return; } for (int i = 0; i < 2 * _numberSteps; i++) { for (int j = 0; j < 2 * _numberSteps; j++) { if (Alea.GetFloat(0.0f, 1.0f) <= density) { CreateTree(new Vector2Int(i, j)); } } } }
private bool ShouldAttachToBuilding(Building b) { return(Alea.GetFloat(0.0f, 1.0f) <= 0.5f); }