void SelectStartVertex() { foreach (var vo in _grid.VertexObject()) { if (vo.Hover()) { if (vo.GetStatus() == VertexStatus.Default) { vo.OnSelect(); _currentVertex = vo; } else if (vo.GetStatus() == VertexStatus.Selected) { vo.OnDeselect(); _currentVertex = null; } } else { if (vo.GetStatus() == VertexStatus.Selected) { vo.OnDeselect(); _currentVertex = null; } } } }
private KMSelectable.OnInteractHandler OnVertexClickedInternal(VertexObject vertex, int i) { return(delegate { if (this.OnVertexClicked != null) { OnVertexClicked.Invoke(this, new VertexPressedEventArgs(vertex, i)); } return false; }); }
void SelectNewCurrent() { foreach (var vo in _vertexObjects) { if (vo.GetStatus() == VertexStatus.Default) { vo.OnSelect(); _currentVertex = vo; break; } } }
public void UnselectGroupByID(int ID) { RenderFile MV = GameObject.Find("MODEL VIEWER").GetComponent <RenderFile>(); int GroupID = ID; for (int x = 0; x < Groups[GroupID].Count; x++) { VertexObject V = GameObject.Find("Model Data").transform.GetChild(Groups[GroupID][x]).GetComponent <VertexObject>(); if (V.Selected == true) { V.UnselectObject(); } } }
void StepToAdjacent() { List <VertexObject> _validVertexes = new List <VertexObject>(6); if (_currentVertex != null) { var adj = _currentVertex.Vertex.GetConnectedVertexs(); foreach (var vi in adj) { if (_vertexObjects[vi].GetStatus() != VertexStatus.Visited) { _validVertexes.Add(_vertexObjects[vi]); } } if (_validVertexes.Count == 0) { _currentVertex.Visit(); SelectNewCurrent(); return; } var next = _validVertexes.SelectMin(v => { return(_evaluator.Evaluate(v.transform.position)); }); int v0 = _currentVertex.Vertex.GetIndex(); int v1 = next.Vertex.GetIndex(); int edge = _grid.GetGrid().GetEdge(v0, v1); _edgeObjects[edge].SetActive(false); _currentVertex.Visit(); _currentVertex = next; _currentVertex.OnSelect(); } else { _currentVertex = _vertexObjects[Random.Range(0, _vertexObjects.Count)]; _currentVertex.OnSelect(); } }