public class EntityAnimationController<T extends IEntity> extends AnimationController implements IEntityAnimationController
Modifier and Type | Class and Description |
---|---|
protected class |
EntityAnimationController.AnimationRule |
Constructor and Description |
---|
EntityAnimationController(T entity) |
EntityAnimationController(T entity,
Animation defaultAnimation,
Animation... animations) |
EntityAnimationController(T entity,
Spritesheet sprite) |
EntityAnimationController(T entity,
Spritesheet sprite,
boolean loop) |
Modifier and Type | Method and Description |
---|---|
void |
addAnimationRule(java.util.function.Predicate<IEntity> rule,
java.util.function.Function<IEntity,java.lang.String> animationName)
Registers an animation rule that will be evaluated if there is currently no
animation playing that is defined to loop.
|
static <T> java.lang.String[] |
getDefaultSpritePrefixes(java.lang.Class<T> cls) |
T |
getEntity() |
protected java.lang.String |
getSpritePrefix() |
boolean |
isAutoScaling() |
void |
scaleSprite(float scale) |
void |
scaleSprite(float scaleX,
float scaleY) |
void |
setAutoScaling(boolean scaling) |
protected void |
setSpritePrefix(java.lang.String prefix) |
void |
update()
This method is called by the game loop on all objects that need to update
their attributes.
|
add, add, addListener, attach, buildCurrentCacheKey, detach, getAffineTransform, getAnimation, getAnimations, getCurrentAnimation, getCurrentSprite, getCurrentSprite, getDefaultAnimation, getImageEffects, hasAnimation, isPlaying, playAnimation, remove, remove, removeListener, setAffineTransform, setDefaultAnimation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, addListener, getAffineTransform, getAnimation, getAnimations, getCurrentAnimation, getCurrentSprite, getCurrentSprite, getDefaultAnimation, getImageEffects, hasAnimation, isPlaying, playAnimation, remove, remove, removeListener, setAffineTransform, setDefaultAnimation
attach, detach
public EntityAnimationController(T entity)
public EntityAnimationController(T entity, Animation defaultAnimation, Animation... animations)
public EntityAnimationController(T entity, Spritesheet sprite)
public EntityAnimationController(T entity, Spritesheet sprite, boolean loop)
public static <T> java.lang.String[] getDefaultSpritePrefixes(java.lang.Class<T> cls)
public void addAnimationRule(java.util.function.Predicate<IEntity> rule, java.util.function.Function<IEntity,java.lang.String> animationName)
IEntityAnimationController
addAnimationRule
in interface IEntityAnimationController
rule
- The rule that must be fulfilled for the animation to be appliedanimationName
- The callback that evaluates the actual animation name that will be
appliedpublic T getEntity()
getEntity
in interface IEntityController
public void update()
IUpdateable
update
in interface IUpdateable
update
in class AnimationController
protected java.lang.String getSpritePrefix()
protected void setSpritePrefix(java.lang.String prefix)
public boolean isAutoScaling()
isAutoScaling
in interface IEntityAnimationController
public void setAutoScaling(boolean scaling)
setAutoScaling
in interface IEntityAnimationController
public void scaleSprite(float scaleX, float scaleY)
scaleSprite
in interface IEntityAnimationController
public void scaleSprite(float scale)
scaleSprite
in interface IEntityAnimationController