예제 #1
0
 public void ChangeParent(TrueAStarNode newParent)
 {
     _parent = newParent;
     if (_parent != null)
     {
         _G = _parent._G + 1;
     }
     else
     {
         _G = 0;
     }
 }
예제 #2
0
    public TrueAStarNode(TrueAStarNode parent, Vector2 location, Vector2 target)
    {
        _parent   = parent;
        _location = location;
        if (_parent != null)
        {
            _G = parent._G + 1;
        }
        else
        {
            _G = 0;
        }

        // simple Manhattan distance method
        _H = (int)Vector3.Magnitude(target - location);
    }