예제 #1
0
    private void CheckNeigbours()
    {
        foreach (Vector2Int direction in RandomizeDirectionOfSearch())
        {
            Vector2Int explorationcoordinates = searchCenter.GetGridPos() + direction;
            print("exploring " + explorationcoordinates);
            try
            {
                Waypoint2 neighbour = grid[explorationcoordinates];

                //neighbour.SetTopColor(gameControler.ColorExploration);
                if (neighbour.isExplored == true || queueOfWaypoints.Contains(neighbour))
                {
                    //do nothing
                }
                else
                {
                    queueOfWaypoints.Enqueue(neighbour);
                    neighbour.foundByWaypoint = searchCenter;
                }
                CheckIsEnd(neighbour);
            }
            catch
            {
                //do nothing
            }
        }
    }
예제 #2
0
 private void SnapToGrid()
 {
     transform.position = new Vector3(waypoint.GetGridPos().x *waypoint.GetGridSize(), 0f, waypoint.GetGridPos().y *waypoint.GetGridSize());
 }