Skip to content

Commit 04ac90b

Browse files
committed
Refactoring.
1 parent 857b8fa commit 04ac90b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Assets/Scripts/Common/TileItemsPool.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ public TileItemsPool(IReadOnlyCollection<TileModel> tiles, Transform itemsContai
2626
}
2727
}
2828

29-
public IGridTile GetTile(TileGroup group)
29+
public IGridTile GetGridTile(TileGroup tileGroup)
3030
{
31-
var tiles = _itemsPool[group];
32-
var tile = tiles.Count == 0 ? CreateTile(_tilePrefabs[group]) : tiles.Dequeue();
33-
tile.SetActive(true);
31+
var tiles = _itemsPool[tileGroup];
32+
var gridTile = tiles.Count == 0 ? CreateTile(_tilePrefabs[tileGroup]) : tiles.Dequeue();
33+
gridTile.SetActive(true);
3434

35-
return tile;
35+
return gridTile;
3636
}
3737

38-
public void ReturnTile(IGridTile tile)
38+
public void ReturnGridTile(IGridTile gridTile)
3939
{
40-
if (tile is IStatefulSlot statefulSlot)
40+
if (gridTile is IStatefulSlot statefulSlot)
4141
{
4242
statefulSlot.ResetState();
4343
}
4444

45-
tile.SetActive(false);
46-
_itemsPool[tile.Group].Enqueue(tile);
45+
gridTile.SetActive(false);
46+
_itemsPool[gridTile.Group].Enqueue(gridTile);
4747
}
4848

4949
private IGridTile CreateTile(GameObject tilePrefab)

Assets/Scripts/Common/UnityGameBoardRenderer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private void SetTile(int rowIndex, int columnIndex, TileGroup group)
168168
var currentTile = _gridSlotTiles[rowIndex, columnIndex];
169169
if (currentTile != null)
170170
{
171-
_tileItemsPool.ReturnTile(currentTile);
171+
_tileItemsPool.ReturnGridTile(currentTile);
172172
}
173173

174174
var gridTile = GetTile(rowIndex, columnIndex, group);
@@ -179,10 +179,10 @@ private void SetTile(int rowIndex, int columnIndex, TileGroup group)
179179

180180
private IGridTile GetTile(int rowIndex, int columnIndex, TileGroup group)
181181
{
182-
var tile = _tileItemsPool.GetTile(group);
183-
tile.SetWorldPosition(GetWorldPosition(rowIndex, columnIndex));
182+
var gridTile = _tileItemsPool.GetGridTile(group);
183+
gridTile.SetWorldPosition(GetWorldPosition(rowIndex, columnIndex));
184184

185-
return tile;
185+
return gridTile;
186186
}
187187

188188
private TileGroup GetNextAvailableGroup(TileGroup group)

0 commit comments

Comments
 (0)