36 lines
681 B
C#
36 lines
681 B
C#
using UnityEngine;
|
|
|
|
namespace Mtree
|
|
{
|
|
public class SplitFunction : TreeFunctionAsset
|
|
{
|
|
public int number = 25;
|
|
|
|
public float splitAngle = 0.5f;
|
|
|
|
public float splitRadius = 0.6f;
|
|
|
|
public float start = 0.2f;
|
|
|
|
public float spread = 1f;
|
|
|
|
public override void Init(TreeFunctionAsset parent, bool preserveSettings = false)
|
|
{
|
|
base.Init(parent);
|
|
base.name = "Split";
|
|
}
|
|
|
|
public override void DrawProperties()
|
|
{
|
|
}
|
|
|
|
public override void Execute(MTree tree)
|
|
{
|
|
base.Execute(tree);
|
|
Random.InitState(seed);
|
|
int selection = ((!(parent == null)) ? parent.id : 0);
|
|
tree.Split(selection, number, splitAngle, id, splitRadius, start, spread, 0f);
|
|
}
|
|
}
|
|
}
|