package eu.midnightdust.yaytris.util;

import eu.midnightdust.yaytris.Tetris;

import java.util.TimerTask;

/**
 * Defines our custom timer task that handles falling pieces.
 */
public class GravityTimerTask extends TimerTask {
    @Override
    public void run() {
        if (Tetris.getSpace().getCurrentTetromino() != null) {
            Tetris.updateTime();
            Tetris.getSpace().getCurrentTetromino().fall();
            Tetris.getUi().getGamePanel().repaint();
        }
    }
}
