Beispiel #1
0
    public void LaunchSavedStartFigure(Vector3 startPosition, int figureIndex, int rotationCount, int nextFigureIndex)
    {
        currentFigureSpeed = slowFigureSpeed;

        int[,] figureMatrix = FigureTypes.GetFigureByIndex(figureIndex);
        currentFigure       = CreateFigure(figureMatrix, figureIndex);
        currentFigure.transform.localPosition = startPosition;
        currentFigureCoord = GetCellСoordByPosition(startPosition);
        figScript          = currentFigure.GetComponent <Figure>();

        for (int i = 0; i < rotationCount; i++)
        {
            figScript.Rotate();
        }

        currentCell = GetCellByPosition(startPosition);
        UpdateFallFigureTip();

        OnFigureCreate(CreateFigure(FigureTypes.GetFigureByIndex(nextFigureIndex), nextFigureIndex, false));
    }
Beispiel #2
0
    public void LaunchStartFigure()
    {
        Vector3 startPosition = GetFigureStartPosition();

        currentFigureSpeed = slowFigureSpeed;

        int figureIndex;

        if (nextFigureIndex == -1)
        {
            figureIndex = FigureTypes.GetRangdomIndex();
        }
        else
        {
            figureIndex = nextFigureIndex;
        }

        nextFigureIndex     = FigureTypes.GetRangdomIndex();
        int[,] figureMatrix = FigureTypes.GetFigureByIndex(figureIndex);
        currentFigure       = CreateFigure(figureMatrix, figureIndex);
        figScript           = currentFigure.GetComponent <Figure>();

        currentCell = GetCellByPosition(startPosition);
        if (CheckIfCellIsFreeForBlock(currentCell))
        {
            currentFigure.transform.localPosition = startPosition;
            currentFigureCoord = new Vector2(1000, 1000);
            CheckIfFigureCanExistInCoord(figScript, GetCellСoordByPosition(startPosition));
            currentFigureCoord = GetCellСoordByPosition(startPosition);
            UpdateFallFigureTip();
        }

        currentDelayBeforeFigureLanding    = 0;
        figureFallDelayDecreaseCurrentTime = 0;
        figureFastFalling = false;

        OnFigureCreate(CreateFigure(FigureTypes.GetFigureByIndex(nextFigureIndex), nextFigureIndex, false));
    }