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 AnimationRenderComponent
Render component used to render animals.protected String
Current animation playing (excluding direction suffix)protected String
Current direction of animal.protected static final String
Idle prefix to play idle animationprotected static final String
Run prefix to play run animationprotected static final String
Walk prefix to play walk animation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Play idle animation with current directionprotected void
Play run animation with current directionprotected void
Play walk animation with current directionvoid
create()
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
-
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:
-
animator
Render component used to render animals. -
direction
Current direction of animal. -
currentAnimation
Current animation playing (excluding direction suffix)
-
-
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
-