Ejemplo n.º 1
0
    public virtual void OnPathComplete(Path _p)
    {
        ABPath p = _p as ABPath;

        if (p == null)
        {
            throw new System.Exception("This function only handles ABPaths, do not use special path types");
        }

        // Claim the new path
        // This is used for path pooling
        p.Claim(this);

        // Path couldn't be calculated of some reason.
        // More info in p.errorLog (debug string)
        if (p.error)
        {
            p.Release(this);
            return;
        }
        goalList.Add(new PathDest(p.endPoint, p.GetTotalLength()));

        // Release the previous path
        // This is used for path pooling
        if (path != null)
        {
            path.Release(this);
        }

        // Replace the old path
        path = p;
    }