Ejemplo n.º 1
0
        public override void Execute(MTree tree)
        {
            base.Execute(tree);

            Random.InitState(seed);
            int selection = parent == null ? 0 : parent.id;

            tree.Split(selection, number, splitAngle, id, splitRadius, start, spread, 0f);
        }
        public void Execute(MTree tree)
        {
            int selection = parent == null ? 0 : parent.id;

            Random.InitState(seed);


            if (type == FunctionType.Trunk)
            {
                tree.AddTrunk(Vector3.down * TheightOffset, Vector3.up, Tlength, Tradius, TradiusMultiplier, Tresolution, Trandomness
                              , id, TrootShape, TrootRadius, TrootHeight, TrootResolution, ToriginAttraction);
            }


            if (type == FunctionType.Grow)
            {
                tree.Grow(Glength, GlengthCurve, Gresolution, GsplitProba, GsplitProbaCurve, GsplitAngle, GmaxSplits, selection
                          , id, Grandomness, Gradius, GsplitRadius, GupAttraction, GgravityStrength, 0f, 0.001f);
            }

            if (type == FunctionType.Split)
            {
                tree.Split(selection, Snumber, SsplitAngle, id, SsplitRadius, Sstart, Sspread, 0f);
            }

            if (type == FunctionType.Branch)
            {
                tree.AddBranches(selection, Blength, BlengthCurve, Bresolution, Bnumber, BsplitProba, BsplitProbaCurve, Bangle
                                 , Brandomness, Bshape, Bradius, BupAttraction, id, Bstart, BgravityStrength, 0f, 0.001f);
            }

            if (type == FunctionType.Leaf)
            {
                tree.AddLeafs(LmaxRadius, Lnumber, LleafMesh, Lsize, LoverrideNormals, LminWeight, LmaxWeight, selection, 70, Lprocedural, Llength, Lresolution, LuLoops, LgravityStrength);
            }
        }