MiroslavJelaska/SpaceInvaders

View on GitHub
src/events/commands/MoveInvadersToNextLineAndChangeDirectionOfMovement.java

Summary

Maintainability
A
0 mins
Test Coverage
package events.commands;

import game.Game;
import utilities.Command;

public class MoveInvadersToNextLineAndChangeDirectionOfMovement implements Command {
    @Override
    public void Apply(Game game) {
        game.allInvaderShips
        .stream()
        .filter(invaderShip -> !invaderShip.IsGoingToChangeDirection())
        .forEach(invader -> {
            invader.ChangeDirectionOfMovement();
            invader.MoveToNextLine();
        });
    }
}