DoopelPonger
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
CoopPowerUpController Class Reference

Class designated to draw the power up meter, listen for charge events, and triggering power ups. This class is too large and should be broken up. Also the code is too convoluted and should be reworked. More...

Inheritance diagram for CoopPowerUpController:
Inheritance graph
[legend]
Collaboration diagram for CoopPowerUpController:
Collaboration graph
[legend]

Public Member Functions

void Awake ()
 Initialize the references and event listeners. More...
 
void OnDestroy ()
 Remove the event listeners when the player dies. More...
 
void FixedUpdate ()
 Update the position of the slider UI element based on the change and notify the animator of the charge. More...
 
void SetChargePercent (float percent)
 Force the slider UI to be at a specific position. Used to show a small animation when the player tries to use a power up when the charge isn't full. More...
 
float DecreaseCharge (float decreaseAmount)
 Take away charge from the player, used when the player activates a shield. More...
 
bool ActivatePower ()
 If the power up is full, activate the power up. More...
 
float GetCurrentCharge ()
 

Public Attributes

CoopPlayerPowerUpDecider powerUpDecider
 
CoopPlayerAnimatorController playerAnimator
 
CoopPlayer player
 
int maxCharge
 
CoopPowerUpIcon powerUpIcon
 
Slider slider
 
float fillRate
 
float spillRate
 

Static Public Attributes

static readonly float chargeAmount = 1f
 

Detailed Description

Class designated to draw the power up meter, listen for charge events, and triggering power ups. This class is too large and should be broken up. Also the code is too convoluted and should be reworked.

Member Function Documentation

◆ ActivatePower()

bool CoopPowerUpController.ActivatePower ( )

If the power up is full, activate the power up.

Returns
True if the power up was triggered, false for any other reason.

◆ Awake()

void CoopPowerUpController.Awake ( )

Initialize the references and event listeners.

◆ DecreaseCharge()

float CoopPowerUpController.DecreaseCharge ( float  decreaseAmount)

Take away charge from the player, used when the player activates a shield.

Parameters
decreaseAmountHow much charge to remove.

◆ FixedUpdate()

void CoopPowerUpController.FixedUpdate ( )

Update the position of the slider UI element based on the change and notify the animator of the charge.

◆ GetCurrentCharge()

float CoopPowerUpController.GetCurrentCharge ( )
Returns
The current charge value.

◆ OnDestroy()

void CoopPowerUpController.OnDestroy ( )

Remove the event listeners when the player dies.

◆ SetChargePercent()

void CoopPowerUpController.SetChargePercent ( float  percent)

Force the slider UI to be at a specific position. Used to show a small animation when the player tries to use a power up when the charge isn't full.

Member Data Documentation

◆ chargeAmount

readonly float CoopPowerUpController.chargeAmount = 1f
static

◆ fillRate

float CoopPowerUpController.fillRate

When adding charge to the player, the fillRate is how fast the slider should change.

◆ maxCharge

int CoopPowerUpController.maxCharge

Max amount of charge the player can hold.

◆ player

CoopPlayer CoopPowerUpController.player

The player the power up belongs to.

◆ playerAnimator

CoopPlayerAnimatorController CoopPowerUpController.playerAnimator

The player animator used to notify the animation delegates the charge percent.

◆ powerUpDecider

CoopPlayerPowerUpDecider CoopPowerUpController.powerUpDecider

Once the power up is full, the powerUpDecider is called to get a power up to use.

◆ powerUpIcon

CoopPowerUpIcon CoopPowerUpController.powerUpIcon

UI element that shows the player what power up they have.

◆ slider

Slider CoopPowerUpController.slider

UI element that shows how much charge the player has.

◆ spillRate

float CoopPowerUpController.spillRate

When the power up is activated, how fast the UI slider will drain.


The documentation for this class was generated from the following file: