Class AreaEntity
java.lang.Object
ch.epfl.cs107.play.engine.actor.Entity
ch.epfl.cs107.play.areagame.actor.AreaEntity
- All Implemented Interfaces:
Interactable,Acoustics,Actor,Graphics,Updatable,Positionable
- Direct Known Subclasses:
CellMouseIndicator,CollectableAreaEntity,DraggableAreaEntity,MovableAreaEntity
Area Entities are assigned to at least one Area Cell which make them Interactable
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.epfl.cs107.play.areagame.actor.Interactable
Interactable.Listener -
Constructor Summary
ConstructorsConstructorDescriptionAreaEntity(Area area, Orientation orientation, DiscreteCoordinates position) Default AreaEntity constructor -
Method Summary
Modifier and TypeMethodDescriptionGetter for the coordinates of the main cell occupied by the AreaEntityGetter for the orientationprotected AreaGetter for the owner areaprotected booleanTell if the mouse is over any of the currentCells of the entityvoidonEntering(List<DiscreteCoordinates> coordinates) Called when this Interactable enters a cellvoidonLeaving(List<DiscreteCoordinates> coordinates) Called when this Interactable leaves a cellprotected booleanorientate(Orientation orientation) Orientate the AreaEntity to a new orientationprotected voidUpdate the current position (i.e.protected voidsetOwnerArea(Area newArea) Set the owner area with new valueMethods inherited from class ch.epfl.cs107.play.engine.actor.Entity
getPosition, getTransform, getVelocityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.epfl.cs107.play.areagame.actor.Interactable
acceptInteraction, getCurrentCells, isCellInteractable, isViewInteractable, takeCellSpace
-
Constructor Details
-
AreaEntity
Default AreaEntity constructor- Parameters:
area- (Area): Owner area. Not nullorientation- (Orientation): Initial orientation of the entity in the Area. Not nullposition- (DiscreteCoordinate): Initial position of the entity in the Area. Not null
-
-
Method Details
-
getOwnerArea
Getter for the owner area- Returns:
- (Area)
-
setOwnerArea
Set the owner area with new value- Parameters:
newArea- (Area): the new value. Not null
-
getOrientation
Getter for the orientation- Returns:
- (Orientation): current orientation
-
orientate
Orientate the AreaEntity to a new orientation- Parameters:
orientation- (Orientation): The new orientation. Not null- Returns:
- (boolean): if the orientation change happens, by default always true
-
getCurrentMainCellCoordinates
Getter for the coordinates of the main cell occupied by the AreaEntity- Returns:
- (DiscreteCoordinates)
-
isMouseOver
protected boolean isMouseOver()Tell if the mouse is over any of the currentCells of the entity- Returns:
- (boolean)
-
setCurrentPosition
Description copied from class:EntityUpdate the current position (i.e. after motion) after position change, the transform need to be updated to. Hence set it to null- Overrides:
setCurrentPositionin classEntity- Parameters:
v- (Vector): The new Position. Not null
-
onLeaving
Description copied from interface:InteractableCalled when this Interactable leaves a cell- Specified by:
onLeavingin interfaceInteractable- Parameters:
coordinates- left cell coordinates
-
onEntering
Description copied from interface:InteractableCalled when this Interactable enters a cell- Specified by:
onEnteringin interfaceInteractable- Parameters:
coordinates- entered cell coordinates
-