Skip to content

HumanAnimationController

Ahmad Abu-Aysha edited this page Sep 9, 2023 · 2 revisions

Introduction

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.

Human Animations

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.

Usage

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())

Sequence Diagram

The following sequence diagram illustrates the life cycle of a HumanAnimationController

UML Diagram

The following UML diagram shows the class structure and interactions of the HumanAnimationController.

Clone this wiki locally