public override void OnInspectorGUI() { serializedObject.Update(); Undo.RecordObject(target, "Modified Plotter"); EditorGUILayout.Space(); EditorGUILayout.LabelField("Tween Method", EditorStyles.boldLabel); _mmPlotter.TweenMethodIndex = EditorGUILayout.Popup("Tween Method", _mmPlotter.TweenMethodIndex, _typeDisplays, EditorStyles.popup); //int newItem = EditorGUILayout.Popup(0, _typeDisplays) - 1; //DrawDefaultInspector(); DrawPropertiesExcluding(serializedObject, _excludedProperties); if (GUILayout.Button("Draw Graph")) { _mmPlotter.DrawGraph(); } serializedObject.ApplyModifiedProperties(); }
protected virtual void GeneratePlotters() { this.transform.MMDestroyAllChildren(); BindingFlags flags = BindingFlags.Public | BindingFlags.Static; MethodInfo[] methods = typeof(MMTweenDefinitions).GetMethods(flags); int row = 0; int column = 0; float yCoordinate = 0; for (int i = 0; i < methods.Length; i++) { _position.x = column * Spacing.x; _position.y = yCoordinate; MMPlotter plotter = Instantiate(PlotterPrefab); plotter.transform.SetParent(this.transform); plotter.transform.localPosition = _position; plotter.TweenMethodIndex = i; string tweenName = plotter.TweenName(plotter.TweenMethodIndex); plotter.gameObject.name = tweenName; Material newMaterial = LinearMaterial; if (tweenName.Contains("Linear")) { newMaterial = LinearMaterial; } if (tweenName.Contains("Quadratic")) { newMaterial = QuadraticMaterial; } if (tweenName.Contains("Cubic")) { newMaterial = CubicMaterial; } if (tweenName.Contains("Quartic")) { newMaterial = QuarticMaterial; } if (tweenName.Contains("Quintic")) { newMaterial = QuinticMaterial; } if (tweenName.Contains("Sinusoidal")) { newMaterial = SinusoidalMaterial; } if (tweenName.Contains("Bounce")) { newMaterial = BounceMaterial; } if (tweenName.Contains("Overhead")) { newMaterial = OverheadMaterial; } if (tweenName.Contains("Exponential")) { newMaterial = ExponentialMaterial; } if (tweenName.Contains("Elastic")) { newMaterial = ElasticMaterial; } if (tweenName.Contains("Circular")) { newMaterial = CircularMaterial; } plotter.SetMaterial(newMaterial); plotter.GetMethodsList(); plotter.DrawGraph(); if (column >= RowLength - 1) { column = 0; row++; if (row % 2 == 0) { yCoordinate += Spacing.y + VerticalOddSpacing; } else { yCoordinate += Spacing.y; } } else { column++; } } }