public virtual void Grow(BranchLines s) { if (depth <= 0) { children.Add(new Flower(0, to, to)); return; } if (depth <= 1) { var flowers = Random.Range(0, 2); for (int i = 0; i < flowers; i++) { children.Add(new Flower(0, Vector3.Lerp(from, to, Random.Range(0.75f, 0.9f)), to)); } } int count = Random.Range(1, s.branches); for (int i = 0; i < count; i++) { var q = Quaternion.AngleAxis(Random.Range(s.rotation.x, s.rotation.y), Vector3.forward); var segment = new Segment(depth - 1, to, to + q * (to - from) * Random.Range(s.decay.x, s.decay.y)); segment.Grow(s); children.Add(segment); } }
public override void Draw(BranchLines s) { s.SetColor(petal); for (int i = 0; i < 8; i++) { float r = (float)i / 8 * TWO_PI + offset; float x = Mathf.Cos(r), y = Mathf.Sin(r); var p = new Vector3(x, y, 0f) * 0.1f * t; s.DrawLine(from, from + p); } s.NoLights(); s.SetColor(head); s.DrawCircle(from, Quaternion.LookRotation(Vector3.forward), 0.025f * t); }
public override void Grow(BranchLines s) { }
public virtual void Draw(BranchLines s) { s.SetColor(Color.black); s.DrawLine(from, cur); children.ForEach(c => c.Draw(s)); }