コード例 #1
0
    public override void OnInspectorGUI()
    {
        EditorGUI.BeginChangeCheck();

        lSystem.axiom = EditorGUILayout.TextField("Axiom", lSystem.axiom);

        lSystem.numberOfIterations = EditorGUILayout.IntSlider("Iterations", lSystem.numberOfIterations, 0, 10);

        List <char> keyz = lSystem.demRulz.Keys.ToList();

        foreach (var key in keyz)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(key + " = ");
            var value = EditorGUILayout.TextField(lSystem.demRulz[key]);
            lSystem.EditRule(key, value);
            if (GUILayout.Button("X"))
            {
                lSystem.DeleteRule(key);
            }
            EditorGUILayout.EndHorizontal();
        }

        newRule = EditorGUILayout.TextField(newRule);
        if (GUILayout.Button("AddRule"))
        {
            lSystem.AddRule(newRule);
            newRule = "Yo bling rule here, n***a!";
        }

        EditorGUILayout.Separator();
        turtle.angle    = EditorGUILayout.Slider("Angle", turtle.angle, 0f, 360f);
        turtle.distance = EditorGUILayout.Slider("Distance", turtle.distance, -10f, float.MaxValue);
        EditorGUILayout.Separator();

        if (GUILayout.Button("Benjamin"))
        {
            lSystemBehaviour.generatedString = lSystem.Generate();
        }

        if (EditorGUI.EndChangeCheck())
        {
            SceneView.RepaintAll();
        }
    }