-
Notifications
You must be signed in to change notification settings - Fork 9
Companion Inventory
saakshigupta2002 edited this page Oct 9, 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.
![Screenshot 2023-10-10 at 9 57 48 AM](https://private-user-images.githubusercontent.com/62831255/273738793-89cfe8ca-f469-46c3-80c0-9d3b93996cd5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MjExNDksIm5iZiI6MTczOTQyMDg0OSwicGF0aCI6Ii82MjgzMTI1NS8yNzM3Mzg3OTMtODljZmU4Y2EtZjQ2OS00NmMzLTgwYzAtOWQzYjkzOTk2Y2Q1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA0MjcyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM0NTU4YTZjNmFhNzFhZjQ2NmFhMGJiOGFlZTE1ZjA5OWJjOWExNjMxMWFkMzk5ZTM3NmI0MjE3ZmExNWY2YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Mq_cPKMxOlbMbeWnDpuA47AsNp-pef3ZKCrO7fsOS8c)
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files