Package com.csse3200.game.components.npc
Class AnimalAnimationController
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.npc.AnimalAnimationController
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
- Direct Known Subclasses:
HostileAnimationController
This class listens to events relevant to a chicken entity's state and plays the animation when one
of the events is triggered.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AnimationRenderComponentRender component used to render animals.protected StringCurrent animation playing (excluding direction suffix)protected StringCurrent direction of animal.protected static final StringIdle prefix to play idle animationprotected static final StringRun prefix to play run animationprotected static final StringWalk prefix to play walk animation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPlay idle animation with current directionprotected voidPlay run animation with current directionprotected voidPlay walk animation with current directionvoidcreate()Create component by retrieving animator, setting start direction and animation, and adding event listeners.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, write
-
Field Details
-
animator
Render component used to render animals. -
direction
Current direction of animal. -
currentAnimation
Current animation playing (excluding direction suffix) -
WALK_PREFIX
Walk prefix to play walk animation- See Also:
-
RUN_PREFIX
Run prefix to play run animation- See Also:
-
IDLE_PREFIX
Idle prefix to play idle animation- See Also:
-
-
Constructor Details
-
AnimalAnimationController
public AnimalAnimationController()
-
-
Method Details
-
create
public void create()Create component by retrieving animator, setting start direction and animation, and adding event listeners. -
animateWalk
protected void animateWalk()Play walk animation with current direction -
animateRun
protected void animateRun()Play run animation with current direction -
animateIdle
protected void animateIdle()Play idle animation with current direction
-