private void OnGridCreated(GridWorldSize worldSize)
 {
     if (_gridCamera != null)
     {
         _gridCamera.orthographicSize = worldSize.GetWorldSize().x + 3.5f;
     }
 }
        public Vector3[,,] BuildGrid()
        {
            _worldSize = new GridWorldSize();

            _elementPositions = new Vector3[_gridRows, _gridColumns, _gridDepth];

            Vector3 startPosition = GetPosition();

            _worldSize.SetWorldSize(startPosition);

            for (int depth = 0; depth < _gridDepth; depth++)
            {
                float z = startPosition.z - depth * (_elementSize.z + _elementPadding.z);
                _worldSize.SetDepth(z);

                for (int row = 0; row < _gridRows; row++)
                {
                    float y = startPosition.y - row * (_elementSize.y + _elementPadding.y);
                    _worldSize.SetHeight(y);

                    for (int column = 0; column < _gridColumns; column++)
                    {
                        float x = startPosition.x - column * (_elementSize.x + _elementPadding.x);
                        _worldSize.SetWidth(x);
                        _elementPositions[row, column, depth] = new Vector3(x, y, z);
                    }
                }
            }


            OnGridCreated.Invoke(_worldSize);
            return(_elementPositions);
        }