Class WhiteListCell
java.lang.Object
fr.r1r0r0.deltaengine.model.elements.cells.Cell
fr.r1r0r0.deltaengine.model.elements.cells.RestrictiveCell
fr.r1r0r0.deltaengine.model.elements.cells.WhiteListCell
- All Implemented Interfaces:
Element<java.lang.Integer>
public final class WhiteListCell extends RestrictiveCell
A specific RestrictiveCell, who only allows every given entities to cross it.
If entity class was not given, it will refuse to be crossed by it.
-
Field Summary
Fields inherited from class fr.r1r0r0.deltaengine.model.elements.cells.RestrictiveCell
restrictiveList -
Constructor Summary
Constructors Constructor Description WhiteListCell(int x, int y, Sprite sprite, java.util.Collection<java.lang.Class<? extends Entity>> restrictiveList)Default constructor. -
Method Summary
Modifier and Type Method Description booleanisCrossableBy(Entity entity)Checks if given entity can cross this cell.Methods inherited from class fr.r1r0r0.deltaengine.model.elements.cells.Cell
getCoordinates, getDimension, getName, getSprite, setCoordinates, setDimension, setSpriteMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WhiteListCell
public WhiteListCell(int x, int y, Sprite sprite, java.util.Collection<java.lang.Class<? extends Entity>> restrictiveList)Default constructor. Set a case sprite and coordinates in the map, and a collection of entities' class.- Parameters:
x- the abscissa coordinate of the cell in the map. Coordinates values are integers.y- the ordinate coordinate of the cell in the map. Coordinates values are integers.restrictiveList- Collection of entities allowed to cross this cellsprite- the sprite to apply on the case
-
-
Method Details
-
isCrossableBy
Description copied from class:CellChecks if given entity can cross this cell. If entity cannot cross cell, then it will be blocked.- Specified by:
isCrossableByin classCell- Parameters:
entity- entity to check if he can cross- Returns:
- boolean true if given entity can cross the cell, false otherwise.
-