void FillBarrelMarkerPool() { for (int i = 0; i < 10; i++) { BarrelMarker newMarker = Instantiate(barrelMarker, transform).GetComponent <BarrelMarker>(); newMarker.gameObject.SetActive(false); barrelMarkersPool.Enqueue(newMarker); } }
public void PlaceBarrelMarker(Tile selectedTile) { waitingToPlace = false; if (barrelMarkersPool.Count < 1) { FillBarrelMarkerPool(); } BarrelMarker toPlace = barrelMarkersPool.Dequeue(); toPlace.Initialize(selectedTile, barrelsToDrop[placementIndex]); toPlace.gameObject.SetActive(true); activeMarkers.Add(toPlace); placementIndex++; UI_Manager.instance.boatPanel.RemoveBarrelUI(); if (placementIndex >= barrelAmount) { StopBombardment(); } }