GameEngine.Pathfinding.ANode.SetParent C# (CSharp) Méthode

SetParent() public méthode

Sets the specified node as the current nodes Parent. The method will automatically recalculate the total Length of the current node as well as update the childe reference for the parent being set.
public SetParent ( ANode parent ) : void
parent ANode
Résultat void
        public void SetParent(ANode parent)
        {
            if (parent == null)
                Length = 0;
            else
            {
                parent.Child = this;

                if (IsDiagonalNeighbor(Parent))
                    Length = parent.Length + DIAGONAL_COST;
                else
                    Length = parent.Length + NORMAL_COST;
            }
        }