Skip to content

Companion Powerup Activation Display

Maxwell Schroder edited this page Oct 19, 2023 · 2 revisions

CompanionPowerupActivationDisplay Class

The CompanionPowerupActivationDisplay class is responsible for managing the activation of all powerups in the powerup inventory

Class Overview

  • Package: com.csse3200.game.components.Companion
  • Inherits From: UIComponent
  • Dependencies: CompanionPowerupInventoryComponent, Entity

Member Variables

companion: An Entity representing the companion.

labelStyle: A String holding the label style.

localPowerupsInventoryAmount: A HashMap containing the local copy of PowerupsInventoryAmount.

localPowerupActivationList: An ArrayList of type PowerupType used for implementation.

powerupActivationlistIndex: An Integer representing the index of the activated powerup.

previousPowerupType: A PowerupType representing the previously activated powerup.

Various PowerupConfig type variables to represent different types of powerups (e.g., deathPotion, healthPotion, etc.)

powerupActivationButton: A Button representing the main activation button.

powerupLabel: A Label representing the label for the powerup.

Other UI elements like leftButton, rightButton, displayedPowerupImage, and powerupActivationButtonTable.

powerupConfigs: An instance of PowerupConfigs.

Methods

Constructor: Initializes labelStyle.

create(): Called at the start of runtime. Creates the UI component for the powerup activation button and ensures it updates when the companion's powerup inventory is updated.

addActors(): Creates the UI components required for the button and the navigation buttons.

#addPowerupActivationButton(): Creates the powerup activation button in the center.

attemptedPowerupActivationButtonPress(): when powerup activation button is pressed, try to use a powerup if there is one

Clone this wiki locally