Example #1
0
    bool CheckIsVallidPosition(out Transform minoError) //Проверяем возможность движения Tetromino, узнаем какая из mino была неверно установлена
    {
        minoError = null;
        bool  check   = true;
        float maxPosX = 0;

        foreach (Transform mino in transform)
        {
            Game.Point pos = game.ReverseVector(positionDeterminationMino(mino));
            Transform  transformAtGridPosition;
            if (!game.CheckIsInsideGrid(pos) || ((transformAtGridPosition = game.GetTransformAtGridPosition(pos)) != null && transformAtGridPosition.parent != transform))
            {
                check = false;
                if (maxPosX < Mathf.Abs(mino.localPosition.x))
                {
                    minoError = mino;
                    maxPosX   = Mathf.Abs(mino.localPosition.x);
                }
            }
        }
        if (check)
        {
            minoError = null;
        }
        return(check);
    }
Example #2
0
 bool CheckIsVallidPosition() //Проверяем возможность движения Tetromino
 {
     foreach (Transform mino in transform)
     {
         Game.Point pos = game.ReverseVector(positionDeterminationMino(mino));
         Transform  transformAtGridPosition;
         if (!game.CheckIsInsideGrid(pos) || ((transformAtGridPosition = game.GetTransformAtGridPosition(pos)) != null && transformAtGridPosition.parent != transform))
         {
             return(false);
         }
     }
     return(true);
 }