public BlockView Unpool(BlockView prefab, Transform parent) { if (!blockPool.TryPop(prefab.name, out var newBlock)) { newBlock = Instantiate(prefab, parent); newBlock.name = prefab.name; newBlock.gameObject.isStatic = true; return(newBlock); } newBlock.transform.SetParent(parent, true); return(newBlock); }
BlockView CreateBlock(BlockView blockPrefab) { if (!blockPool.TryPop(blockPrefab.name, out var newBlock)) { newBlock = Instantiate(blockPrefab, transform); newBlock.BlockName = blockPrefab.name; newBlock.name = blockPrefab.name; newBlock.gameObject.isStatic = true; } else { newBlock.IsDesroyed = false; } return(newBlock); }
public void PoolBlock(BlockView block) { blockPool.Push(block.BlockName, block); block.transform.position = new Vector3(0, 0, -1000); block.IsDesroyed = true; }
public void Pool(BlockView blockView) { blockPool.Push(blockView.name, blockView); blockView.transform.SetParent(_pool, true); }