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,EventListener
-
Field Summary
FieldsFields inherited from class de.gurkenlabs.litiengine.entities.Entity
ANY_MESSAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCombatEntityListener(CombatEntityListener listener) Adds a CombatEntityListener to this entity.voiddie()Causes this entity to die.protected voidGets the list of effects currently applied to this entity.Gets the hit box.Gets the attributes.Gets the current target of this entity.intgetTeam()Gets the team of this entity.float[]getTweenValues(TweenType tweenType) Gets one or many values from the target object associated to the given tween type.voidhit(int damage) Inflicts damage to this entity.voidInflicts damage to this entity with a specific ability.booleanisDead()Checks if is dead.booleanisFriendly(ICombatEntity entity) Checks if is friendly.booleanChecks if is indestructible.booleanChecks if this entity is neutral.voidonDeath(CombatEntityDeathListener listener) Registers a listener to be called when this entity dies.voidonHit(CombatEntityHitListener listener) Registers a listener to be called when this entity is hit.voidonResurrect(CombatEntityResurrectListener listener) Registers a listener to be called when this entity is resurrected.voidRemoves a CombatEntityListener from this entity.voidremoveListener(CombatEntityDeathListener listener) Removes a death listener from this entity.voidremoveListener(CombatEntityHitListener listener) Removes a hit listener from this entity.voidremoveListener(CombatEntityResurrectListener listener) Removes a resurrect listener from this entity.voidResurrect.voidsetIndestructible(boolean indestructible) Sets the indestructible state of this entity.voidsetTarget(ICombatEntity target) Sets the target of this entity.voidsetTeam(int team) Sets the team.voidsetTweenValues(TweenType tweenType, float[] newValues) This method is called in a Tween's update() method to set the new interpolated values.booleanwasHit(int timeSpan) Checks if this entity was hit within a specific time span.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, setWidthMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, setCollisionTypeMethods 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:
-
-
Constructor Details
-
CombatEntity
public CombatEntity()Instantiates a newCombatEntity.
-
-
Method Details
-
addCombatEntityListener
Description copied from interface:ICombatEntityAdds a CombatEntityListener to this entity.- Specified by:
addCombatEntityListenerin interfaceICombatEntity- Parameters:
listener- the listener to add
-
removeCombatEntityListener
Description copied from interface:ICombatEntityRemoves a CombatEntityListener from this entity.- Specified by:
removeCombatEntityListenerin interfaceICombatEntity- Parameters:
listener- the listener to remove
-
onHit
Description copied from interface:ICombatEntityRegisters a listener to be called when this entity is hit.- Specified by:
onHitin interfaceICombatEntity- Parameters:
listener- the listener to register
-
onDeath
Description copied from interface:ICombatEntityRegisters a listener to be called when this entity dies.- Specified by:
onDeathin interfaceICombatEntity- Parameters:
listener- the listener to register
-
onResurrect
Description copied from interface:ICombatEntityRegisters a listener to be called when this entity is resurrected.- Specified by:
onResurrectin interfaceICombatEntity- Parameters:
listener- the listener to register
-
removeListener
Description copied from interface:ICombatEntityRemoves a hit listener from this entity.- Specified by:
removeListenerin interfaceICombatEntity- Parameters:
listener- the listener to remove
-
removeListener
Description copied from interface:ICombatEntityRemoves a death listener from this entity.- Specified by:
removeListenerin interfaceICombatEntity- Parameters:
listener- the listener to remove
-
removeListener
Description copied from interface:ICombatEntityRemoves a resurrect listener from this entity.- Specified by:
removeListenerin interfaceICombatEntity- Parameters:
listener- the listener to remove
-
die
public void die()Description copied from interface:ICombatEntityCauses this entity to die.- Specified by:
diein interfaceICombatEntity
-
getAppliedEffects
Description copied from interface:ICombatEntityGets the list of effects currently applied to this entity.- Specified by:
getAppliedEffectsin interfaceICombatEntity- Returns:
- a list of applied effects
-
getHitPoints
Gets the attributes.- Specified by:
getHitPointsin interfaceICombatEntity- Returns:
- the attributes
-
getHitBox
Gets the hit box.- Specified by:
getHitBoxin interfaceICombatEntity- Returns:
- the hit box
-
getTarget
Description copied from interface:ICombatEntityGets the current target of this entity.- Specified by:
getTargetin interfaceICombatEntity- Returns:
- the target entity
-
getTeam
public int getTeam()Description copied from interface:ICombatEntityGets the team of this entity.- Specified by:
getTeamin interfaceICombatEntity- Returns:
- the team as an integer
-
getTweenValues
Description copied from interface:TweenableGets 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:
getTweenValuesin interfaceTweenable- Overrides:
getTweenValuesin 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:TweenableThis method is called in a Tween's update() method to set the new interpolated values.- Specified by:
setTweenValuesin interfaceTweenable- Overrides:
setTweenValuesin 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) Description copied from interface:ICombatEntityInflicts damage to this entity.- Specified by:
hitin interfaceICombatEntity- Parameters:
damage- the amount of damage to inflict
-
hit
Description copied from interface:ICombatEntityInflicts damage to this entity with a specific ability.- Specified by:
hitin interfaceICombatEntity- Parameters:
damage- the amount of damage to inflictability- the ability causing the damage
-
fireDeathEvent
protected void fireDeathEvent() -
isDead
public boolean isDead()Checks if is dead.- Specified by:
isDeadin interfaceICombatEntity- Returns:
- true, if is dead
-
isFriendly
Checks if is friendly.- Specified by:
isFriendlyin interfaceICombatEntity- Parameters:
entity- the entity- Returns:
- true, if is friendly
-
isIndestructible
public boolean isIndestructible()Checks if is indestructible.- Specified by:
isIndestructiblein interfaceICombatEntity- Returns:
- true, if is indestructible
-
isNeutral
public boolean isNeutral()Description copied from interface:ICombatEntityChecks if this entity is neutral.- Specified by:
isNeutralin interfaceICombatEntity- Returns:
- true if the entity is neutral, false otherwise
-
resurrect
public void resurrect()Resurrect.- Specified by:
resurrectin interfaceICombatEntity
-
setIndestructible
public void setIndestructible(boolean indestructible) Description copied from interface:ICombatEntitySets the indestructible state of this entity.- Specified by:
setIndestructiblein interfaceICombatEntity- Parameters:
indestructible- the indestructible state to set
-
setTarget
Description copied from interface:ICombatEntitySets the target of this entity.- Specified by:
setTargetin interfaceICombatEntity- Parameters:
target- the target entity to set
-
setTeam
public void setTeam(int team) Sets the team.- Specified by:
setTeamin interfaceICombatEntity- Parameters:
team- the new team
-
wasHit
public boolean wasHit(int timeSpan) Description copied from interface:ICombatEntityChecks if this entity was hit within a specific time span.- Specified by:
wasHitin interfaceICombatEntity- Parameters:
timeSpan- the time span to check- Returns:
- true if the entity was hit within the time span, false otherwise
-