public bool CanMoveToEdge(EdgeView edge)
 {
     if (m_CurrentNode == edge.GetStart())
     {
         return(m_CurrentNode.GetNode().IsNeighbor(edge.GetEnd().GetNode()));
     }
     else if (m_CurrentNode == edge.GetEnd())
     {
         return(m_CurrentNode.GetNode().IsNeighbor(edge.GetStart().GetNode()));
     }
     return(false);
 }
Ejemplo n.º 2
0
    private void ShowEdge(EdgeView edge)
    {
        Handles.color = edge.IsOriented() ? Color.red : Color.green;
        Vector2 start = edge.GetStart().transform.position;
        Vector2 end   = edge.GetEnd().transform.position;

        Handles.DrawAAPolyLine(10, 2, start, end);
    }
 public void MoveToEdge(EdgeView edge)
 {
     if (CanMoveToEdge(edge))
     {
         Vector3 start = edge.GetStart().transform.position;
         Vector3 end   = edge.GetEnd().transform.position;
         m_TargetPos = (start + end) / 2;
         StartCoroutine(MoveRoutine());
         new GameFlowEvent(EGameFlowAction.EnterEdge).Push();
     }
 }
 public void OnEdge(EdgeView edge, bool enter)
 {
     if (enter)
     {
         m_CurrentEdge = edge;
         MoveToEdge(edge);
     }
     else
     {
         Assert.IsTrue(m_CurrentEdge.GetEdge().UseNode(m_CurrentNode.GetNode()));
         MoveToNode(m_CurrentNode == m_CurrentEdge.GetStart() ? m_CurrentEdge.GetEnd() : m_CurrentEdge.GetStart());
     }
 }
 public void OnNormalEdge(EdgeView edge)
 {
     Assert.IsTrue(edge.GetEdge().UseNode(m_CurrentNode.GetNode()));
     MoveToNode(m_CurrentNode == edge.GetStart() ? edge.GetEnd() : edge.GetStart());
 }