//Used for drawing the L-System after the angle has been changed void renderState(current state, float newAngle) { points.Clear(); foreach (char character in state.State) { switch (character) { case '+': currentAngle -= newAngle; break; case '-': currentAngle += newAngle; break; case '[': stack.Push(new AnglePos(currentAngle, currentPosition)); break; case ']': AnglePos obj = stack.Pop(); currentAngle = obj.angle; currentPosition = obj.position; Debug.Log(obj.angle); break; default: createObject(); break; } } }
//Used for drawing the L-System with the initial angle void renderState(LSystemState state) { foreach (char character in state.State) { switch (character) { case '+': currentAngle -= state.Angle; break; case '-': currentAngle += state.Angle; break; case '[': stack.Push(new AnglePos(currentAngle, currentPosition)); break; case ']': AnglePos obj = stack.Pop(); currentAngle = obj.angle; currentPosition = obj.position; break; default: createObject(); break; } } }