public bTreeStatus NewRandomTree() { var rtn = new bTreeStatus(); /* basic branch stuff */ rtn.BranchGrowLengthPerHour = RValue(0.04f, 0.01f, 0.01f); rtn.BranchGrowWidthPerHour = RValue(0.011f, 0.001f); rtn.BranchTaperFactor = RValue(0.6f, 0.05f); rtn.BranchTaperVariation = RValue(0.05f, 0.05f, 0.05f); rtn.MaxBranchSize = RValue(1.0f, 0.1f); rtn.MaxBranchWidth = RValue(0.5f, 0.05f); /* branch split rules */ rtn.BranchSplitChancePerHour = RValue(0.1f, 0.001f); rtn.BranchSplitAngleDownMax = RValue(60f, 5f); rtn.BranchSplitAngleDownMin = RValue(30f, 5f); rtn.BranchSplitAngleUpMax = RValue(56f, 1f); rtn.BranchSplitAngleUpMin = RValue(32f, 1f, 2f); rtn.MaxBranchCount = RValue(2, 1); /* segment rules */ rtn.BranchSplitSegmentChancePerHour = RValue(0.2f, 0.01f); rtn.BranchSplitSegmentAngleVariation = RValue(-25f, 4f); rtn.MaxSegmentChain = RValue(3, 1); /* limits */ rtn.TotalMaxSegments = RValue(30, 5); rtn.TotalMaxBranches = RValue(20, 5); rtn.TotalMaxLeaves = RValue(70, 5); rtn.MaxSegmentGrowAge = RValue(100.0f, 5f); /* boosts */ rtn.BoostBranchChange = 0.5f; /* trunk */ rtn.MaxTrunkSize = RValue(0.5f, 0f, 0.1f); /* leaves */ rtn.LeafChancePerHour = RValue(0.08f, 0.01f); rtn.LeafGrowPerHour = RValue(0.005f, 0.0005f); rtn.MaxLeafSize = RValue(0.3f, 0.05f); rtn.MaxLeafSizeVariation = RValue(0.1f, 0.05f); return rtn; }
/** Grow this branch for one standard time period */ public void Grow(bTreeStatus config, float hours) { Age += hours; config.UpdateBranchSize(this, hours); config.MaybeAddBranchSegment(this, hours); config.MaybeAddBranch(this, hours); config.MaybeAddLeaf(this, hours); if (NextSegment != null) NextSegment.Grow(config, hours); foreach (var b in Branches) { b.Grow(config, hours); } foreach (var l in Leaves) { l.Grow(config, hours); } }
/** Gather energy from this branch (mostly from leaves) */ public void AccumulateEnergy(bTreeStatus config, float hours) { }
/** Grow this leaf */ public void Grow(bTreeStatus config, float hours) { if (_dead) return; if (Growing()) config.UpdateLeafSize(this, hours); }