public override void OnInspectorGUI() { base.OnInspectorGUI(); PlatformObject platformObject = (PlatformObject)target; bool sectionTransition = EditorGUILayout.Toggle("Is Section Transition", platformObject.sectionTransition); if (sectionTransition != platformObject.sectionTransition) { platformObject.sectionTransition = sectionTransition; EditorUtility.SetDirty(target); } if (sectionTransition) { List <int> fromSection = platformObject.fromSection; List <int> toSection = platformObject.toSection; if (SectionSelectionInspector.showSectionTransitions(ref fromSection, ref toSection)) { platformObject.fromSection = fromSection; platformObject.toSection = toSection; EditorUtility.SetDirty(target); } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); GUILayout.Label("Sections:"); InfiniteObject infiniteObject = (InfiniteObject)target; List <int> sections = infiniteObject.sections; if (SectionSelectionInspector.ShowSections(ref sections, false)) { infiniteObject.sections = sections; EditorUtility.SetDirty(target); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); PlatformObject platformObject = (PlatformObject)target; bool sectionTransition = EditorGUILayout.Toggle("Is Section Transition", platformObject.sectionTransition); if (sectionTransition != platformObject.sectionTransition) { platformObject.sectionTransition = sectionTransition; EditorUtility.SetDirty(target); } if (sectionTransition) { List <int> fromSection = platformObject.fromSection; List <int> toSection = platformObject.toSection; if (SectionSelectionInspector.ShowSectionTransitions(ref fromSection, ref toSection)) { platformObject.fromSection = fromSection; platformObject.toSection = toSection; EditorUtility.SetDirty(target); } } List <Vector3> controlPoints = platformObject.controlPoints; if (controlPoints != null && controlPoints.Count > 0) { bool updated = false; GUILayout.Label("Control Points:"); for (int i = 0; i < controlPoints.Count; ++i) { GUILayout.BeginHorizontal(GUILayout.Width(100)); GUILayout.Label(string.Format("{0} - {1}", i + 1, controlPoints[i])); if (GUILayout.Button("X", GUILayout.Width(30))) { controlPoints.RemoveAt(i); updated = true; break; } GUILayout.EndHorizontal(); } if (updated) { platformObject.controlPoints = controlPoints; ComputeBezierCurve(false); EditorUtility.SetDirty(target); } } if (GUILayout.Button("Add Control Point")) { if (controlPoints == null) { controlPoints = new List <Vector3>(); } controlPoints.Add(Vector3.up); platformObject.controlPoints = controlPoints; ComputeBezierCurve(false); EditorUtility.SetDirty(target); } }