void InsertVertexAndCreateTriangle(MapNavMeshDefinition data) { if (SelectedVertices.Count() == 2) { var id = NewId(); ArrayUtility.Add(ref data.Vertices, new MapNavMeshVertex { Id = id, Position = Vector3.Lerp( data.GetVertex(SelectedVertices.First()).Position, data.GetVertex(SelectedVertices.Last()).Position, 0.5f ).RoundToInt() }); SelectedVertices.Add(id); CreateTriangle(data); SelectedVertices.Clear(); SelectedVertices.Add(id); Save(); } }
void DuplicateVertex(MapNavMeshDefinition data) { if (SelectedVertices.Count == 1) { var id = NewId(); ArrayUtility.Add(ref data.Vertices, new MapNavMeshVertex { Id = id, Position = data.GetVertex(SelectedVertices.First()).Position.RoundToInt() }); Save(); SelectedVertices.Clear(); SelectedVertices.Add(id); } }