-
Notifications
You must be signed in to change notification settings - Fork 4
HumanAnimationController
The HumanAnimationController class listens for events triggered by the entity it is attached to and plays entity animations according to the event heard. This allows the animationRenderComponent to operate according to the Observer pattern and remain decoupled from entity logic.
The class is made up of eventListeners for each event, (registered with the owner entity) and their corresponding callback functions. Every event listener has its own callback function and plays one animation, and in some cases a sound effect.
There are currently more animations listed in this class than are being used, but these are planned to be implemented in future sprints.
The events being listened for are triggered in HumanWanderTask, EngineerCombatTask, HumanWaitTask and HumanMovementTask.
A HumanAnimationController can be added to an entity as a component after creation of the entity (this usually occurs in the EngineerFactory.createEngineer()
function)
engineer.addComponent(new HumanAnimationController())
The following sequence diagram illustrates the life cycle of a HumanAnimationController
The following UML diagram shows the class structure and interactions of the HumanAnimationController.