/// <summary> /// Simplify the drawn line and assign it to the road editor. /// </summary> private void finalizeLine() { MeshRoad road = (MeshRoad)target; List <Vector3> simplifiedLine = LineSmoother.biasedMovingAverages(roadLinePoints, road.averageWindow); road.setRoadLinePoints(simplifiedLine); roadLinePoints.Clear(); // No need to keep this data twice road.debugRoadLine(); }
/// <summary> /// Draw custom inspector. /// </summary> public override void OnInspectorGUI() { DrawDefaultInspector(); MeshRoad road = (MeshRoad)target; // Target layer dropdown targetLayer = EditorGUILayout.Popup("Target Layer", targetLayer, getLayerNames()); // Add features to draw road drawingEnabled = EditorGUILayout.Toggle("Enable Drawing", drawingEnabled); // Add button to generate road if (GUILayout.Button("Generate Road")) { road.generate(); } // Add button to fit associated terrains to this road if (GUILayout.Button("Fit Terrains")) { road.fitTerrains(); } // Add button to clear road if (GUILayout.Button("Clear Road")) { road.clear(); } // Add debug buttons if (GUILayout.Button("Debug Road Line")) { road.debugRoadLine(); } if (GUILayout.Button("Debug Cross Sections")) { road.debugCrossSections(); } }