Exemple #1
0
    /*
     * public void AddFuzz()
     * {
     *  // Take each corner and add 10% fuzz
     *
     *  float fuzz_x = size_x / 10;
     *  float fuzz_z = size_z / 10;
     *
     *  bottom_left_pos.x += Random.Range((bottom_left_pos.x - fuzz_x), (bottom_left_pos.x + fuzz_x));
     *
     *
     *
     *
     *  if (child_nodes.Count == 0)
     *      return;
     *
     *  foreach(GameObject child in child_nodes)
     *  {
     *      child.GetComponent<Node>().AddFuzz();
     *  }
     * }*/


    private void GenerateBuilding(ObjectGenerator _object_gen, float _road_offset)
    {
        float x = Vector3.Distance(bottom_left_pos, bottom_right_pos);
        float z = Vector3.Distance(bottom_left_pos, top_left_pos);

        new_pos = new Vector3(bottom_left_pos.x + (x / 2), 0, bottom_left_pos.z + (z / 2));

        var new_building = _object_gen.GenerateBuilding(new_pos, x, z);

        new_building.transform.parent = this.transform;
    }