Class PlayfieldModifier


  • public class PlayfieldModifier
    extends Object
    A tool to modify a playfield and place entities on it.
    Author:
    Tim Neumann
    • Constructor Detail

      • PlayfieldModifier

        public PlayfieldModifier​(Playfield playfield)
        Create a new playfield modifier for the given playfield.
        Parameters:
        playfield - The playfield to create the modifier for
    • Method Detail

      • placeEntityAt

        public void placeEntityAt​(Entity entity,
                                  Position position)
        Place the given entity at the given position on the playfield.
        Parameters:
        entity - The entity to place
        position - The position to place the entity at
      • placeMultipleEntitiesAt

        public void placeMultipleEntitiesAt​(Supplier<? extends Entity> entityFactory,
                                            int count,
                                            Position position)
        Place the given number of entities supplied by the given factory at the given location.
        Parameters:
        entityFactory - The factory to get the entities from
        count - The number of entities to place
        position - The position to place the entities at
      • placeEntityAtEachPosition

        public void placeEntityAtEachPosition​(Supplier<? extends Entity> entityFactory,
                                              Iterable<Position> positions)
        Place an entity supplied by the given factory at each of the given positions
        Parameters:
        entityFactory - The factory to get the entities from
        positions - A list of positions to place the entities at