Exemplo n.º 1
0
    public void FindNextTarget()
    {
        movingPath.Reset();
        MapNode curNode  = GetPosition();
        MapNode nextNode = curNode;

        while (nextNode == null || nextNode == curNode || nextNode.IsWall())
        {
            int x = Random.Range(bornX - wanderDistance, bornX + wanderDistance);
            int y = Random.Range(bornY - wanderDistance, bornY + wanderDistance);
            nextNode = MapHandler.GetMapNode(x, y);
        }
        List <Vector2> path = MapHandler.FindPath(curNode, nextNode);

        SetPath(path);
    }
Exemplo n.º 2
0
 public void ResetPath()
 {
     movingPath.Reset();
 }