Exemplo n.º 1
0
        IEnumerator Loop()
        {
            float pos = 0f;

            while (true)
            {
                ControlTree   controlTree   = Instantiate(tree, new Vector3(pos, 0f, 0f), Quaternion.identity).GetComponent <ControlTree>();
                TreeGenerator treeGenerator = GetComponent <TreeGenerator>();
                treeGenerator.MakeTree();
                treeGenerator.SetMesh(controlTree);
                // controlTree.SetProgress(1f);
                yield return(new WaitForSeconds(1f));

                pos += 2f;
            }
        }
Exemplo n.º 2
0
        public void SetMesh(ControlTree controlTree, GameObject leave)
        {
            controlTree.gameObject.GetComponent <MeshFilter>().sharedMesh = mesh;
            List <Transform> leaves = new List <Transform>();

            for (int i = 0; i < leavePosition.Count; i++)
            {
                Transform leaveTransform = MonoBehaviour.Instantiate(leave, controlTree.transform).transform;
                leaveTransform.localPosition = leavePosition[i];
                leaveTransform.localScale    = Vector3.zero;
                leaves.Add(leaveTransform);
            }
            controlTree.radius        = radius;
            controlTree.branchNum     = branchNum;
            controlTree.leaveList     = leaves;
            controlTree.leaveProgress = leaveProgress;
            controlTree.ResetTree();
        }
Exemplo n.º 3
0
 public void SetMesh(ControlTree controlTree)
 {
     treeMesh.SetMesh(controlTree, leave);
 }