Exemple #1
0
    private bool IsNotBlockingEnemies(int X, int Y)
    {
        towersMap[X, Y] = true;
        Astar.SetGrid(towersMap);

        for (int y = 0; y < ySize; y++)
        {
            for (int x = 0; x < xSize; x++)
            {
                if (enemiesCount[y, x] > 0)
                {
                    if (Astar.CalcPath(new Node(y, x), destination).Count == 0)
                    {
                        towersMap[X, Y] = false;
                        return(false);
                    }
                }
            }
        }

        towersMap[X, Y] = false;
        return(true);
    }
Exemple #2
0
 public void CalculatePath(Node from, Node to)
 {
     SetPath(new Queue <Node>(Astar.CalcPath(from, to).AsEnumerable().Reverse()));
 }