Class CombatEntity
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.CollisionEntity
de.gurkenlabs.litiengine.entities.CombatEntity
- All Implemented Interfaces:
EntityRenderedListener
,EntityRenderListener
,ICollisionEntity
,ICombatEntity
,IEntity
,Tweenable
,java.util.EventListener
public class CombatEntity
extends CollisionEntity
implements ICombatEntity
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_HITPOINTS
Constructor Summary
Constructors Constructor Description CombatEntity()
Instantiates a newCombatEntity
.Method Summary
Modifier and Type Method Description void
addCombatEntityListener(CombatEntityListener listener)
void
die()
java.util.List<Effect>
getAppliedEffects()
java.awt.Shape
getHitBox()
Gets the hit box.RangeAttribute<java.lang.Integer>
getHitPoints()
Gets the attributes.ICombatEntity
getTarget()
int
getTeam()
float[]
getTweenValues(TweenType tweenType)
Gets one or many values from the target object associated to the given tween type.void
hit(int damage)
void
hit(int damage, Ability ability)
boolean
isDead()
Checks if is dead.boolean
isFriendly(ICombatEntity entity)
Checks if is friendly.boolean
isIndestructible()
Checks if is indestructible.boolean
isNeutral()
void
onDeath(CombatEntityDeathListener listener)
void
onHit(CombatEntityHitListener listener)
void
onResurrect(CombatEntityResurrectListener listener)
void
removeCombatEntityListener(CombatEntityListener listener)
void
removeListener(CombatEntityDeathListener listener)
void
removeListener(CombatEntityHitListener listener)
void
removeListener(CombatEntityResurrectListener listener)
void
resurrect()
Resurrect.void
setIndestructible(boolean indestructible)
void
setTarget(ICombatEntity target)
void
setTeam(int team)
Sets the team.void
setTweenValues(TweenType tweenType, float[] newValues)
This method is called in a Tween's update() method to set the new interpolated values.boolean
wasHit(int timeSpan)
Methods inherited from class de.gurkenlabs.litiengine.entities.CollisionEntity
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, hasCollision, onCollision, refreshCollisionBox, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionType, setHeight, setLocation, setSize, setWidth
Methods inherited from class de.gurkenlabs.litiengine.entities.Entity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, rendered, rendering, renderWithLayer, sendMessage, setAngle, setController, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setVisible, setX, setY, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.gurkenlabs.litiengine.entities.ICollisionEntity
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, hasCollision, onCollision, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionType
Methods inherited from interface de.gurkenlabs.litiengine.entities.IEntity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, detachControllers, getAngle, getBoundingBox, getCenter, getController, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, renderWithLayer, sendMessage, setAngle, setController, setHeight, setLocation, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setSize, setVisible, setWidth, setX, setY
Field Details
DEFAULT_HITPOINTS
public static final int DEFAULT_HITPOINTS- See Also:
- Constant Field Values
Constructor Details
CombatEntity
public CombatEntity()Instantiates a newCombatEntity
.
Method Details
addCombatEntityListener
- Specified by:
addCombatEntityListener
in interfaceICombatEntity
removeCombatEntityListener
- Specified by:
removeCombatEntityListener
in interfaceICombatEntity
onHit
- Specified by:
onHit
in interfaceICombatEntity
onDeath
- Specified by:
onDeath
in interfaceICombatEntity
onResurrect
- Specified by:
onResurrect
in interfaceICombatEntity
removeListener
- Specified by:
removeListener
in interfaceICombatEntity
removeListener
- Specified by:
removeListener
in interfaceICombatEntity
removeListener
- Specified by:
removeListener
in interfaceICombatEntity
die
public void die()- Specified by:
die
in interfaceICombatEntity
getAppliedEffects
- Specified by:
getAppliedEffects
in interfaceICombatEntity
getHitPoints
Gets the attributes.- Specified by:
getHitPoints
in interfaceICombatEntity
- Returns:
- the attributes
getHitBox
public java.awt.Shape getHitBox()Gets the hit box.- Specified by:
getHitBox
in interfaceICombatEntity
- Returns:
- the hit box
getTarget
- Specified by:
getTarget
in interfaceICombatEntity
getTeam
public int getTeam()- Specified by:
getTeam
in interfaceICombatEntity
getTweenValues
Description copied from interface:Tweenable
Gets one or many values from the target object associated to the given tween type. It is used by the Tween Engine to determine starting values.- Specified by:
getTweenValues
in interfaceTweenable
- Overrides:
getTweenValues
in classCollisionEntity
- Parameters:
tweenType
- The tween type of this interpolation, determining which values are modified.- Returns:
- The array of current tween values.
setTweenValues
Description copied from interface:Tweenable
This method is called in a Tween's update() method to set the new interpolated values.- Specified by:
setTweenValues
in interfaceTweenable
- Overrides:
setTweenValues
in classCollisionEntity
- Parameters:
tweenType
- The tween type of this interpolation, determining which values are modified.newValues
- The new values determined by the tween equation.
hit
public void hit(int damage)- Specified by:
hit
in interfaceICombatEntity
hit
- Specified by:
hit
in interfaceICombatEntity
isDead
public boolean isDead()Checks if is dead.- Specified by:
isDead
in interfaceICombatEntity
- Returns:
- true, if is dead
isFriendly
Checks if is friendly.- Specified by:
isFriendly
in interfaceICombatEntity
- Parameters:
entity
- the entity- Returns:
- true, if is friendly
isIndestructible
public boolean isIndestructible()Checks if is indestructible.- Specified by:
isIndestructible
in interfaceICombatEntity
- Returns:
- true, if is indestructible
isNeutral
public boolean isNeutral()- Specified by:
isNeutral
in interfaceICombatEntity
resurrect
public void resurrect()Resurrect.- Specified by:
resurrect
in interfaceICombatEntity
setIndestructible
public void setIndestructible(boolean indestructible)- Specified by:
setIndestructible
in interfaceICombatEntity
setTarget
- Specified by:
setTarget
in interfaceICombatEntity
setTeam
public void setTeam(int team)Sets the team.- Specified by:
setTeam
in interfaceICombatEntity
- Parameters:
team
- the new team
wasHit
public boolean wasHit(int timeSpan)- Specified by:
wasHit
in interfaceICombatEntity