Items structure - UQcsse3200/2024-studio-1 GitHub Wiki
Structure of associated item classes and how they work together
DeployableItemFactory Class
- The DeployableItemFactory is responsible for creating instances of deployable entities. It contains methods like
createBearTrap()
,createTargetDummy()
, andcreateRingFire()
, each of which sets up the components necessary for the specific item. - Entity Creation: Each method in this class returns an Entity, which is the core object representing in-game items and characters. The Entity is composed of different components that define its behavior and appearance.
CollectibleFactory Class
When a new collectible entity needs to be created, the CollectibleFactory is called with a specification. Depending on the type (item, buff, melee, or ranged) it will call either the ItemFactory or WeaponFactory to create the appropriate CollectibleItem. Once a 'Collectible' is created, CollectibleFactory can be used to compose an 'Entity' with the 'Collectible' previously created.
ItemFactory Class
Creates 'Collectible' items that are either a 'UsableItem' or a 'BuffItem'. A usable item is an item that can be stored in the inventory and used for later purposes whereas a buff item is an item that provides an immediate effect to the player upon pickup.
Collectible Interface
An interface implemented by various items that can be picked up and used in the game.
UsableItem Class
Implements the 'Collectible' interface and represents items that can be stored in the players inventory (e.g., 'MedKit', 'Bandage', 'ShieldPotion','BearTrap').
BuffItem Class
Implementes the 'Collectible' interface and represents items that apply effects to the player immediately upon pickup (e.g., EnergyDrink, Syringe, Heart, DivinePotion)
Medkit, Bandage, ShieldPotion Classes
All of these classes extend the 'UsableItem' class and each of these classes apply specific effects to the player.
EnergyDrink, Syringe, Heart, DivinePotion Class
This class extends the 'BuffItem' class and gives the player a specific buff.
UML diagram
Sequence diagram
The sequence diagram are created using https://plantuml.com/