public override bool GetPathTo(Vector3 position, int maxPathfindSteps, bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return(true);
 }
 public override bool GetPathTo(Vector3 aPosition, int aMaxPathfindingSteps, float aMaxPathLength, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
 public override bool GetPathToMoveTarget(bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return(true);
 }
Пример #4
0
    public override bool GetPathToMoveTarget(MoveLookTarget aPathTarget, bool allowOffGraphMovement, out RAINPath path)
    {
        //Debug.Log("Called GetPathToMoveTarget");
        var result = base.GetPathToMoveTarget(aPathTarget, allowOffGraphMovement, out path);

        for (int i = 0; i < path.PathPoints.Count; i++)
        {
            var p = path.PathPoints[i];
            path.PathPoints[i] = new Vector3(Mathf.Round(p.x), 0, Mathf.Round(p.z));
        }

        if (path.PathNodes.Count == 2)
        {
            return(result);
        }

        for (int i = 0; i < path.PathNodes.Count - 1; i++)
        {
            if (path.PathPoints[i] == path.PathPoints[i + 1])
            {
                path.RemovePathNode(i);
                i--;
            }
        }

        bool sameX = false;
        bool sameZ = false;

        for (int i = 0; i < path.PathNodes.Count - 1; i++)
        {
            //if (Mathf.Approximately(path.PathPoints[i].x, AI.Body.transform.position.x) &&
            //    Mathf.Approximately(path.PathPoints[i].z, AI.Body.transform.position.z))
            //{
            //path.RemovePathNode(i);
            //i--;
            //}
            if (sameX)
            {
                if (path.PathPoints[i].x == path.PathPoints[i + 1].x)
                {
                    path.RemovePathNode(i);
                    i--;
                }
                else
                {
                    sameX = false;
                }
            }
            else if (sameZ)
            {
                if (path.PathPoints[i].z == path.PathPoints[i + 1].z)
                {
                    path.RemovePathNode(i);
                    i--;
                }
                else
                {
                    sameZ = false;
                }
            }
            if (!sameX && !sameZ)
            {
                if (path.PathPoints[i].x == path.PathPoints[i + 1].x)
                {
                    sameX = true;
                }
                else if (path.PathPoints[i].z == path.PathPoints[i + 1].z)
                {
                    sameZ = true;
                }
            }
        }
        if (Mathf.Approximately(path.PathPoints[0].x, path.PathPoints[path.PathPoints.Count - 1].x) ||
            Mathf.Approximately(path.PathPoints[0].z, path.PathPoints[path.PathPoints.Count - 1].z))
        {
            for (int i = 1; i < path.PathPoints.Count - 1; i++)
            {
                path.RemovePathNode(i);
                --i;
            }
        }


        return(result);
    }
 public override bool GetPathToMoveTarget(MoveLookTarget aPathTarget, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
 public override bool GetPathToMoveTarget(MoveLookTarget aPathTarget, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 // Seems to not get used
 public override bool GetPathTo(Vector3 aTargetPosition, int aMaxPathfindSteps, float aMaxPathLength, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     //Debug.Log("Called GetPathTo");
     return(base.GetPathTo(aTargetPosition, aMaxPathfindSteps, aMaxPathLength, aAllowOffGraphMovement, out aPath));
 }
 public override bool GetPathToMoveTarget(bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return true;
 }
 public override bool GetPathTo(Vector3 aPosition, int aMaxPathfindingSteps, float aMaxPathLength, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
 public override bool GetPathTo(Vector3 position, int maxPathfindSteps, bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return true;
 }
Пример #11
0
    public override bool GetPathToMoveTarget(MoveLookTarget aPathTarget, bool allowOffGraphMovement, out RAINPath path)
    {
        //Debug.Log("Called GetPathToMoveTarget");
        var result = base.GetPathToMoveTarget(aPathTarget, allowOffGraphMovement, out path);

        for (int i = 0; i < path.PathPoints.Count; i++)
        {
            var p = path.PathPoints[i];
            path.PathPoints[i] = new Vector3(Mathf.Round(p.x), 0, Mathf.Round(p.z));
        }

        if (path.PathNodes.Count == 2)
        {
            return result;
        }

        for (int i = 0; i < path.PathNodes.Count - 1; i++)
        {
            if (path.PathPoints[i] == path.PathPoints[i + 1])
            {
                path.RemovePathNode(i);
                i--;
            }
        }

        bool sameX = false;
        bool sameZ = false;
        for (int i = 0; i < path.PathNodes.Count - 1; i++)
        {
            //if (Mathf.Approximately(path.PathPoints[i].x, AI.Body.transform.position.x) &&
            //    Mathf.Approximately(path.PathPoints[i].z, AI.Body.transform.position.z))
            //{
                //path.RemovePathNode(i);
                //i--;
            //}
            if (sameX)
            {
                if (path.PathPoints[i].x == path.PathPoints[i + 1].x)
                {
                    path.RemovePathNode(i);
                    i--;
                }
                else
                {
                    sameX = false;
                }
            }
            else if (sameZ)
            {
                if (path.PathPoints[i].z == path.PathPoints[i + 1].z)
                {
                    path.RemovePathNode(i);
                    i--;
                }
                else
                {
                    sameZ = false;
                }
            }
            if (!sameX && !sameZ)
            {
                if (path.PathPoints[i].x == path.PathPoints[i + 1].x)
                {
                    sameX = true;
                }
                else if (path.PathPoints[i].z == path.PathPoints[i + 1].z)
                {
                    sameZ = true;
                }
            }
            
        }
        if (Mathf.Approximately(path.PathPoints[0].x, path.PathPoints[path.PathPoints.Count - 1].x) ||
            Mathf.Approximately(path.PathPoints[0].z, path.PathPoints[path.PathPoints.Count - 1].z))
        {
            for (int i = 1; i < path.PathPoints.Count - 1; i++)
            {
                path.RemovePathNode(i);
                --i;
            }
        }


        return result;
    }
Пример #12
0
 // Seems to not get used
 public override bool GetPathTo(Vector3 aTargetPosition, int aMaxPathfindSteps, float aMaxPathLength, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     //Debug.Log("Called GetPathTo");
     return base.GetPathTo(aTargetPosition, aMaxPathfindSteps, aMaxPathLength, aAllowOffGraphMovement, out aPath);
 }