Ejemplo n.º 1
0
        private GameObject[] GenerateRow(Vector3 position, Transform parent)
        {
            var row = new GameObject[View._gridWidth];

            for (int x = 0; x < View._gridWidth; ++x)
            {
                var        newLocation  = new Vector3(position.x + (x * View._gridCellSize), position.y, position.z + 1);
                var        gridUnitType = UnityEngine.Random.Range(0, 100);
                GameObject gridUnitGO   = null;

                if (gridUnitType <= 95)
                {
                    gridUnitGO = SandPool.GetInstance();
                    row[x]     = gridUnitGO;
                }
                else if (gridUnitType <= 97)
                {
                    gridUnitGO = ItemPool.GetInstance();
                }
                else if (gridUnitType <= 100)
                {
                    gridUnitGO = EnemyPool.GetInstance();
                }

                gridUnitGO.transform.localPosition = newLocation;
                gridUnitGO.transform.parent        = parent;
                gridUnitGO.SetActive(true);
            }

            return(row);
        }
Ejemplo n.º 2
0
 private void DestroySand(GameObject sandTile)
 {
     sandTile.SetActive(false);
     sandTile.transform.localPosition = GTFO_POS;
     SandPool.ReturnInstance(sandTile);
 }