예제 #1
0
    public void SetTileAsOccupied(MapCoordinate coordinate)
    {
        _grid.BlockCell(coordinate.ToPosition());

        var events = _enemies.Select(identifier => new PathFinderEvent.PathCalculated(identifier, FindPath(_enemyPositionService[identifier].ToMapCoordinate())));

        foreach (var pathCalulated in events)
        {
            Emit(pathCalulated);
        }
    }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     m_grid = new RoyT.AStar.Grid(40, 25);
     for (int x = -20; x < 19; x++)
     {
         for (int y = -10; y < 14; y++)
         {
             if (map.HasTile(new Vector3Int(x, y, 0)))
             {
                 m_grid.BlockCell(new Position(x + 20, y + 10));
                 //Debug.Log("(" + x + "," + y + ") blocked");
             }
         }
     }
 }
예제 #3
0
 public void BlockCell(Grid grid, Vector2Int position)
 {
     grid.BlockCell(new Position(position.x + startX, position.y + startY));
 }