Ejemplo n.º 1
0
 public void Connect(NavNode other)
 {
     if (!neighbours.Contains(other))
     {
         neighbours.Add(other);
         other.Connect(this);
     }
 }
Ejemplo n.º 2
0
    public void VerifyNeighbours()
    {
        for (int i = neighbours.Count - 1; i >= 0; i--)
        {
            NavNode node = neighbours[i];
            if (node == null)
            {
                neighbours.RemoveAt(i);
            }
            else if (node == this)
            {
                neighbours.RemoveAt(i);
            }
        }

        foreach (NavNode node in neighbours)
        {
            node.Connect(this);
            this.Connect(node);
        }
    }