//public void HighlightTile(int x, int y) //{ // GameObject highlighter = _highlighterFactory.Create(); // highlighter.transform.position = GetTilePosition(x, y) + new Vector3(0, 0, 0); //} private void GetWalkableTiles(int startX, int starty, MovemntTypes movementType, int radius, HashSet <Vector2Int> s) { int speedOnCurrentTile = GetTile(startX, starty).MoveSpeedForType[movementType]; if (!s.Contains(new Vector2Int(startX, starty)) && speedOnCurrentTile != -1 ) { //HighlightTile(startX, starty); s.Add(new Vector2Int(startX, starty)); } if (radius > speedOnCurrentTile && speedOnCurrentTile != -1) { foreach (var tile in GetFreeNeighbors(new Vector2Int(startX, starty))) { GetWalkableTiles(tile.x, tile.y, movementType, radius - speedOnCurrentTile, s); } } }
public HashSet <Vector2Int> GetAvailableTilesInRangeForMovemntType(int startX, int startY, MovemntTypes movemntType, int radius) { HashSet <Vector2Int> s = new HashSet <Vector2Int>(); GetWalkableTiles(startX, startY, movemntType, radius + 1, s); return(s); }