コード例 #1
0
 public override bool GetPathTo(Vector3 position, int maxPathfindSteps, bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return(true);
 }
コード例 #2
0
 public override bool GetPathTo(Vector3 aPosition, int aMaxPathfindingSteps, float aMaxPathLength, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
コード例 #3
0
 public override bool GetPathToMoveTarget(bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return(true);
 }
コード例 #4
0
ファイル: TileNavigator.cs プロジェクト: edisonwang/GGJ2016
    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);
    }
コード例 #5
0
 public override bool GetPathToMoveTarget(MoveLookTarget aPathTarget, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
 public override bool GetPathToMoveTarget(MoveLookTarget aPathTarget, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
ファイル: TileNavigator.cs プロジェクト: edisonwang/GGJ2016
 // 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));
 }
コード例 #8
0
 public override bool GetPathToMoveTarget(bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return true;
 }
コード例 #9
0
 public override bool GetPathTo(Vector3 aPosition, int aMaxPathfindingSteps, float aMaxPathLength, bool aAllowOffGraphMovement, out RAINPath aPath)
 {
     throw new NotImplementedException();
 }
コード例 #10
0
 public override bool GetPathTo(Vector3 position, int maxPathfindSteps, bool allowOffGraphMovement, out RAINPath path)
 {
     path = null;
     return true;
 }
コード例 #11
0
ファイル: TileNavigator.cs プロジェクト: envy3d/GGJ2016
    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
ファイル: TileNavigator.cs プロジェクト: envy3d/GGJ2016
 // 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);
 }