Пример #1
0
 public bool MoveUp(GameObject brick, bool updateSide)
 {
     if (directionChecker.CheckUp(brick, gameModel.BrickArray) > 0)
     {
         BrickComponent brickComponent = brick.GetComponent <BrickComponent>();
         brickComponent.Location.y = brickComponent.Location.y + directionChecker.CheckUp(brick, gameModel.BrickArray);
         //UpdateActualLocation(brickComponent.gameObject);
         if (updateSide == true)
         {
             brickComponent.Side = Sides.Top;
         }
         // Update the brick array so that everything is aligned.
         UpdateBrickArray();
         return(true);
     }
     return(false);
 }
Пример #2
0
    public bool MoveNewBrick(MoveDirection moveDir)
    {
        DirectionChecker directionChecker = Processors.GetComponent <DirectionChecker>();

        switch (moveDir)
        {
        case MoveDirection.Right:
            if (directionChecker.CheckRight(CurrentActiveBrick, BrickArray) > 0)
            {
                MoveBrick(CurrentActiveBrick, MoveDirection.Right, true);
            }
            break;

        case MoveDirection.Left:
            if (directionChecker.CheckLeft(CurrentActiveBrick, BrickArray) > 0)
            {
                MoveBrick(CurrentActiveBrick, MoveDirection.Left, true);
            }
            break;

        case MoveDirection.Up:
            if (directionChecker.CheckUp(CurrentActiveBrick, BrickArray) > 0)
            {
                MoveBrick(CurrentActiveBrick, MoveDirection.Up, true);
            }
            break;

        case MoveDirection.Down:
            if (directionChecker.CheckDown(CurrentActiveBrick, BrickArray) > 0)
            {
                MoveBrick(CurrentActiveBrick, MoveDirection.Down, true);
            }
            break;

        default:
            break;
        }

        int i = 0;

        while (AddNewPlayBrick() != true)
        {
            AddNewPlayBrick();
            i++;

            if (i >= 256)
            {
                break;
            }
        }
        return(true);
    }