Companion Initialization Component - UQcsse3200/2023-studio-2 GitHub Wiki
Overview
The CompanionFactory is a Java class that serves as a factory for creating companion entities within the game. It encapsulates the process of initialization and configuring companion entities. We chose the factory class initially because it is commonly used in the codebase, and suits the needs of a companion entity.
Usage
The usage of this method involves loading configurations, creating factory classes, and assembling the companion entity Properties
Constructor
Java class 'CompanionConfig' to represent the configuration with extending BaseEntityConfig class of the companion entity . This class will serve as a blueprint for the entity's properties.
Methods
createCompanion(Entity playerEntity): Creates a new companion entity based on the provided playerEntity reference. This method assembles various components and configurations to form a fully functional companion entity.
Components
The companion entity is highly similar to the player entity, and has several components: TextureRender, Physics, Hitbox, Collider, CombatStats, CompanionInventory, FollowComponent, and some companion specific ones (CompanionINteractionController and CompanionActions).