Package ch.epfl.cs107.play.areagame.area
Class AreaBehavior
java.lang.Object
ch.epfl.cs107.play.areagame.area.AreaBehavior
- All Implemented Interfaces:
Interactable.Listener,Interactor.Listener
public abstract class AreaBehavior
extends Object
implements Interactable.Listener, Interactor.Listener
AreaBehavior is a basically a map made of Cells. Those cells are used for the game behavior
Note: implementation from Interactable.Listener not excpected from students
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassEach AreaGame will have its own Cell extension. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanEnter(Interactable entity, List<DiscreteCoordinates> coordinates) Indicate if the given Interactable entity can enter the cell at given coordinatesbooleancanLeave(Interactable entity, List<DiscreteCoordinates> coordinates) Indicate if the given Interactable entity can leave the cell at given coordinatesvoidcellInteractionOf(Interactor interactor) Do the interactor interact with Interactable (i.e.voiddropInteractionOf(Draggable draggable, DiscreteCoordinates mouseCoordinates) voidenter(Interactable entity, List<DiscreteCoordinates> coordinates) Do the given interactable entity enter the given cellsprotected AreaBehavior.CellgetCell(int x, int y) protected intprotected intgetRGB(int r, int c) protected intgetWidth()voidleave(Interactable entity, List<DiscreteCoordinates> coordinates) Do the given interactable entity leave the given cellsprotected voidsetCell(int x, int y, AreaBehavior.Cell cell) voidviewInteractionOf(Interactor interactor) Do the interactor interact with Interactable (i.e.
-
Constructor Details
-
AreaBehavior
Default AreaBehavior Constructor- Parameters:
window- (Window): graphic context, not nullname- (String): name of the behavior image, not null
-
-
Method Details
-
dropInteractionOf
-
cellInteractionOf
Description copied from interface:Interactor.ListenerDo the interactor interact with Interactable (i.e. Interactable sharing the same cell)- Specified by:
cellInteractionOfin interfaceInteractor.Listener- Parameters:
interactor- (Interactor). Not null
-
viewInteractionOf
Description copied from interface:Interactor.ListenerDo the interactor interact with Interactable (i.e. Interactable in its field of view cells)- Specified by:
viewInteractionOfin interfaceInteractor.Listener- Parameters:
interactor- (Interactor). Not null
-
setCell
-
getCell
-
getRGB
protected int getRGB(int r, int c) -
getHeight
protected int getHeight() -
getWidth
protected int getWidth() -
canLeave
Description copied from interface:Interactable.ListenerIndicate if the given Interactable entity can leave the cell at given coordinates- Specified by:
canLeavein interfaceInteractable.Listener- Parameters:
entity- (Interactable). Not nullcoordinates- (List of DiscreteCoordinates). Not null- Returns:
- (boolean): true if the entity can leave all the given cell
-
canEnter
Description copied from interface:Interactable.ListenerIndicate if the given Interactable entity can enter the cell at given coordinates- Specified by:
canEnterin interfaceInteractable.Listener- Parameters:
entity- (Interactable). Not nullcoordinates- (List of DiscreteCoordinates). Not null- Returns:
- (boolean): true if the entity can enter all the given cell
-
leave
Description copied from interface:Interactable.ListenerDo the given interactable entity leave the given cells- Specified by:
leavein interfaceInteractable.Listener- Parameters:
entity- (Interactable). Not nullcoordinates- (List of DiscreteCoordinates). Not null
-
enter
Description copied from interface:Interactable.ListenerDo the given interactable entity enter the given cells- Specified by:
enterin interfaceInteractable.Listener- Parameters:
entity- (Interactable). Not nullcoordinates- (List of DiscreteCoordinates). Not null
-