using System.Collections; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEngine; using ConsoleLSystem; using System; public class Turtle3D : TurtleLSystem { public GameObject obj; public GameObject flower; public GameObject leaf; public float angle; protected override void initLiteralInterpretation() { turtleInterpretation = new Dictionary>>(); //turtleInterpretation var transformation = Matrix4x4.Translate(new Vector3(0.0f, 0.1f, 0)) * Matrix4x4.Scale(new Vector3 (0.05f, 0.1f, 0.05f)); turtleInterpretation.Add("+", (float[] args) => new Tuple(null, Matrix4x4.Rotate(Quaternion.Euler(0, 0, -angle)))); turtleInterpretation.Add("-", (float[] args) => new Tuple(null, Matrix4x4.Rotate(Quaternion.Euler(0, 0, angle)))); turtleInterpretation.Add("/", (float[] args) => new Tuple(null, Matrix4x4.Rotate(Quaternion.Euler(0, angle, 0)))); turtleInterpretation.Add("\\", (float[] args) => new Tuple(null, Matrix4x4.Rotate(Quaternion.Euler(0, -angle, 0)))); turtleInterpretation.Add("&", (float[] args) => new Tuple(null, Matrix4x4.Rotate(Quaternion.Euler(angle, 0, 0)))); turtleInterpretation.Add("^", (float[] args) => new Tuple(null, Matrix4x4.Rotate(Quaternion.Euler(-angle, 0, 0)))); turtleInterpretation.Add("F", (float[] args) => new Tuple(flower, Matrix4x4.Rotate(Quaternion.Euler(0, 0, 0)))); turtleInterpretation.Add("L", (float[] args) => new Tuple(leaf, Matrix4x4.Rotate(Quaternion.Euler(0, 0, 0)))); //Wildcard how to represent any other symbol turtleInterpretation.Add("*.*", (float[] args) => new Tuple(obj, transformation)); } }