-
Notifications
You must be signed in to change notification settings - Fork 9
Companion Inventory
RagGul edited this page Oct 5, 2023
·
2 revisions
The CompanionInventoryComponent
class is responsible for managing inventory and weapons for a companion in a game.
-
Package:
com.csse3200.game.components.Companion
-
Inherits From:
Component
-
Dependencies:
CompanionWeapons.CompanionWeaponType
,PowerupComponent
,PowerupType
,Entity
,CompanionWeaponConfigs
-
CompanionWeaponType weaponType
: The currently equipped weapon type. -
int ammoCount
: The current ammunition count for the equipped weapon. -
int maxAmmo
: The maximum ammunition capacity. -
int attackCooldown
: The cooldown time for the companion's attack.
-
CompanionInventoryComponent(CompanionWeaponType weaponType, int ammo, int maxAmmo)
: Constructor to initialize the companion's inventory with a specified weapon type, ammo, and max ammo capacity.
-
CompanionWeaponType getItem()
: Get the currently equipped weapon type. -
int getAmmo()
: Get the current ammunition count. -
void changeItem(CompanionWeaponType weaponType)
: Change the equipped weapon type. -
void changeAmmo(int change)
: Change the ammunition count. -
int getMaxAmmo()
: Get the maximum ammunition capacity. -
void setAttackCooldown(int cooldown)
: Set the attack cooldown. -
int getAttackCooldown()
: Get the attack cooldown. -
void decCoolDown()
: Decrease the attack cooldown timer.
-
Deque<Entity> powerupQueue
: A queue to store power-up items. -
int[] itemQuantity
: An array to store the quantity of each item. -
HashMap<PowerupType, Integer> powerupCounts
: A map to store counts for each power-up type.
-
void addPowerup(Entity item)
: Add a power-up item to the companion's inventory. -
boolean useNextPowerup()
: Retrieve and use the next power-up from the inventory.
-
String equipped
: The currently equipped weapon slot. -
LinkedHashMap<String, CompanionInventoryComponent> equippedWMap
: A map to represent equipped weapons. -
CompanionWeaponConfigs config
: Configuration for weapons.
-
void create()
: Create the initial weapon configuration. -
void update()
: Update the equipped weapon's cooldown timer. -
CompanionWeaponConfigs getConfigs()
: Get the weapon configuration. -
String getEquipped()
: Get the currently equipped weapon slot. -
void setEquipped(String slot)
: Change the active inventory slot to a specific slot. -
ArrayList<CompanionWeaponType> getEquippedWeapons()
: Get a list of currently equipped weapons. -
void changeEquipped(CompanionWeaponType type)
: Update the weapon of the active inventory slot. -
CompanionWeaponType getEquippedType()
: Get the equipped weapon type. -
int GetCurrentAmmo()
: Get the current ammunition for the equipped weapon. -
int GetCurrentMaxAmmo()
: Get the maximum ammunition for the equipped weapon. -
void changeEquippedAmmo(int ammoChange)
: Change the ammunition count for the equipped weapon. -
int getEquippedCooldown()
: Get the cooldown for the equipped weapon. -
void setEquippedCooldown(int coolDown)
: Set the cooldown for the equipped weapon.
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files