Пример #1
0
    public void FillCurrentFigures()
    {
        CurrentFigures = new FigureSpawnInfo[DataStorage.CountOfFigures];
        int level = 0;

        if (DataStorage.IsNextLevel())
        {
            level = DataStorage.GetCurrentLevel() - 1;
        }
        else
        {
            level = Random.Range(0, DataStorage.GetCurrentMaxLevel());
        }
        string[] figures = levels[level].Split('f');
        for (int i = 0; i < DataStorage.CountOfFigures; i++)
        {
            string[] parameters = figures[i].Split(',');
            int      spawnCell  = int.Parse(parameters[2]);
            int      x          = spawnCell / DataStorage.FieldSize.x;
            int      y          = spawnCell % DataStorage.FieldSize.x;
            CurrentFigures[i] = new FigureSpawnInfo(int.Parse(parameters[0]), int.Parse(parameters[1]), x, y);
        }
    }
Пример #2
0
    public GridCell GetFigureSpawnCell(int figureIndex)
    {
        FigureSpawnInfo figureSpawnInfo = levelsParameters.CurrentFigures[figureIndex];

        return(boardGrid.GetGridCell(figureSpawnInfo.PositionX, figureSpawnInfo.PositionY));
    }