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

public abstract class AreaEntity extends Entity implements Interactable
Area Entities are assigned to at least one Area Cell which make them Interactable
  • Constructor Details

    • AreaEntity

      public AreaEntity(Area area, Orientation orientation, DiscreteCoordinates position)
      Default AreaEntity constructor
      Parameters:
      area - (Area): Owner area. Not null
      orientation - (Orientation): Initial orientation of the entity in the Area. Not null
      position - (DiscreteCoordinate): Initial position of the entity in the Area. Not null
  • Method Details

    • getOwnerArea

      protected Area getOwnerArea()
      Getter for the owner area
      Returns:
      (Area)
    • setOwnerArea

      protected void setOwnerArea(Area newArea)
      Set the owner area with new value
      Parameters:
      newArea - (Area): the new value. Not null
    • getOrientation

      public Orientation getOrientation()
      Getter for the orientation
      Returns:
      (Orientation): current orientation
    • orientate

      protected boolean orientate(Orientation orientation)
      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

      public DiscreteCoordinates 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

      protected void setCurrentPosition(Vector v)
      Description copied from class: Entity
      Update the current position (i.e. after motion) after position change, the transform need to be updated to. Hence set it to null
      Overrides:
      setCurrentPosition in class Entity
      Parameters:
      v - (Vector): The new Position. Not null
    • onLeaving

      public void onLeaving(List<DiscreteCoordinates> coordinates)
      Description copied from interface: Interactable
      Called when this Interactable leaves a cell
      Specified by:
      onLeaving in interface Interactable
      Parameters:
      coordinates - left cell coordinates
    • onEntering

      public void onEntering(List<DiscreteCoordinates> coordinates)
      Description copied from interface: Interactable
      Called when this Interactable enters a cell
      Specified by:
      onEntering in interface Interactable
      Parameters:
      coordinates - entered cell coordinates