Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public void PoolBlock(BlockView block)
 {
     blockPool.Push(block.BlockName, block);
     block.transform.position = new Vector3(0, 0, -1000);
     block.IsDesroyed         = true;
 }
Esempio n. 4
0
 public void Pool(BlockView blockView)
 {
     blockPool.Push(blockView.name, blockView);
     blockView.transform.SetParent(_pool, true);
 }