public void RemoveGroundVert(GroundVert groundVert) { if (groundVerts.Contains(groundVert)) { groundVerts.Remove(groundVert); } }
void OnEnable() { grassPatch = (GrassPatch)target; currentSelectedObject = new HitObjectInfo(); currentSelectedGroundVert = new GroundVert(Vector3.zero); Refresh(); }
public GroundVert AddGroundVert(Vector3 vert) { GroundVert groundVert = new GroundVert(vert); groundVerts.Add(groundVert); return(groundVert); }
void DrawUI() { for (int i = 0; i < grassPatch.grassPlanes.Count; i++) { EditorGUILayout.BeginHorizontal(); grassPatch.grassPlanes[i].transform = (Transform)EditorGUILayout.ObjectField(grassPatch.grassPlanes[i].transform, typeof(Transform), true); if (GUILayout.Button("Select")) { currentSelectedObject.transform = grassPatch.grassPlanes[i].transform; currentSelectedObject.plane = grassPatch.grassPlanes[i]; currentSelectedVertex = Vector3.zero; SceneView.RepaintAll(); } if (GUILayout.Button("Remove")) { grassPatch.RemoveGrassPlane(i); currentSelectedObject = new HitObjectInfo(); } EditorGUILayout.EndHorizontal(); } if (currentSelectedObject == null || currentSelectedObject.transform == null) { return; } GrassPlane p = currentSelectedObject.plane; EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorUtils.HorizontalLine(Color.blue); EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); //if (GUILayout.Button("Add Ground Vert")) //{ // currentSelectedGroundVert = p.AddGroundVert(currentSelectedVertex); //} EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); foreach (var groundVert in p.groundVerts) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(groundVert.vertex.ToString()); if (GUILayout.Button("Select")) { currentSelectedVertex = groundVert.vertex; currentSelectedGroundVert = groundVert; SceneView.RepaintAll(); } ; //if (GUILayout.Button("Add")) { groundVert.influencedVerts.Add(currentSelectedVertex); SceneView.RepaintAll(); } //if (GUILayout.Button("Clear")) { groundVert.ClearInfluenced(); SceneView.RepaintAll(); } if (GUILayout.Button("Remove")) { p.RemoveGroundVert(groundVert); SceneView.RepaintAll(); break; } EditorGUILayout.EndHorizontal(); } }