public bool MoveLeft(GameObject brick, bool updateSide) { if (directionChecker.CheckLeft(brick, gameModel.BrickArray) > 0) { BrickComponent brickComponent = brick.GetComponent <BrickComponent>(); brickComponent.Location.x = brickComponent.Location.x - directionChecker.CheckLeft(brick, gameModel.BrickArray); //UpdateActualLocation(brickComponent.gameObject); if (updateSide == true) { brickComponent.Side = Sides.Left; } // Update the brick array so that everything is aligned. UpdateBrickArray(); return(true); } return(false); }
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); }