コード例 #1
0
    public IEnumerator GenerateFlatGrid(int width, int length /*, GridCoordinates startingPosition*/)
    {
        if (BlockGridRenderer.Singleton.isRendered)
        {
            BlockGridRenderer.Singleton.Clear();
        }

        yield return(null);

        _grid = BlockGrid.CreateFlatGrid(width, length, BlockType.RockShale);
        gridGenerationProcess.progress = 1f;

        yield return(null);

        if (_grid != null)
        {
            //_grid.array[startingPosition.x, startingPosition.y].type = BlockType.Ground;
            _grid.startingPosition = new GridCoordinates(Mathf.RoundToInt(width / 2), 0);
            _grid.GetBlock(_grid.startingPosition).type = BlockType.Ground;

            //TODO move to MapEditor scripts
            if (CameraControllerOld.Singleton != null)
            {
                CameraControllerOld.Singleton.freeRoamMovingPoint.position = _grid.startingPosition.GetPositionOffset();
            }
        }

        yield return(null);
    }