Пример #1
0
    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";
    }
Пример #2
0
 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);
     }
 }
Пример #3
0
    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);
    }
Пример #4
0
 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));
             }
         }
     }
 }
Пример #5
0
 private bool ShouldAttachToBuilding(Building b)
 {
     return(Alea.GetFloat(0.0f, 1.0f) <= 0.5f);
 }