Class MovableEntity
- java.lang.Object
-
- de.unistuttgart.informatik.fius.icge.simulation.entity.BasicEntity
-
- de.unistuttgart.informatik.fius.icge.simulation.entity.MovableEntity
-
- All Implemented Interfaces:
Entity
- Direct Known Subclasses:
GreedyEntity
public abstract class MovableEntity extends BasicEntity
A movable entity- Author:
- Tim Neumann
-
-
Field Summary
-
Fields inherited from class de.unistuttgart.informatik.fius.icge.simulation.entity.BasicEntity
endOfLastEnqueuedOperation
-
-
Constructor Summary
Constructors Constructor Description MovableEntity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canMove()
Drawable
getDrawInformation()
Direction
getLookingDirection()
String
getLookingDirectionString()
void
move()
Move this entity forward one field.void
moveIfPossible()
Move this entity forward one field if that is possible.void
turnClockWise()
Turn this entity for 90 degrees in clock wise direction.-
Methods inherited from class de.unistuttgart.informatik.fius.icge.simulation.entity.BasicEntity
enqueueToPerformNewOperation, getPlayfield, getPosition, getSimulation, getTextureHandle, getZPosition, initOnPlayfield, isOnPlayfield, sleep, toString
-
-
-
-
Method Detail
-
getDrawInformation
public Drawable getDrawInformation()
- Specified by:
getDrawInformation
in interfaceEntity
- Overrides:
getDrawInformation
in classBasicEntity
- Returns:
- the information required to draw this entity; must not be null
-
turnClockWise
public void turnClockWise()
Turn this entity for 90 degrees in clock wise direction.
-
getLookingDirection
public Direction getLookingDirection()
- Returns:
- the current looking direction of this entity
-
getLookingDirectionString
@InspectionAttribute(name="LookingDirection") public String getLookingDirectionString()
- Returns:
- the looking direction as a string
-
move
public void move()
Move this entity forward one field.- Throws:
EntityNotOnFieldException
- if this entity is not on a playfieldIllegalMoveException
- if a solid entity is in the way
-
canMove
public boolean canMove()
- Returns:
- whether this entity can move forward one field.
-
moveIfPossible
public void moveIfPossible()
Move this entity forward one field if that is possible.
-
-