Package model.bubbles.playerBubbles
Class ChainReactionManager
java.lang.Object
model.bubbles.playerBubbles.ChainReactionManager
Manages the chain reaction of bubble explosions.
This class handles the chain reaction of bubbles popping when one bubble is popped by the player. It uses a timer to create delays between consecutive bubble pops and manages the count of enemy bubbles popped.
-
Constructor Summary
ConstructorsConstructorDescriptionChainReactionManager(PlayerModel playerModel, PlayerBubbleModel firstPoppedBubble, LinkedList<PlayerBubbleModel> bubbles) Constructs a new ChainReactionManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidchainExplosion(PlayerBubbleModel poppedBubble) Chains the explosion of bubbles.intGets the enemy bubble pop counter.voidIncreases the enemy bubble pop counter.
-
Constructor Details
-
ChainReactionManager
public ChainReactionManager(PlayerModel playerModel, PlayerBubbleModel firstPoppedBubble, LinkedList<PlayerBubbleModel> bubbles) Constructs a new ChainReactionManager.- Parameters:
playerModel- the player modelfirstPoppedBubble- the first bubble poppedbubbles- the list of bubbles
-
-
Method Details
-
chainExplosion
Chains the explosion of bubbles.This method recursively pops all bubbles within the chain reaction radius of the initially popped bubble, creating a chain reaction.
For each bubble within the radius, there is a small delay before the pop.
- Parameters:
poppedBubble- the bubble that was initially popped
-
increaseEnemyBubblePopCounter
public void increaseEnemyBubblePopCounter()Increases the enemy bubble pop counter. -
getEnemyBubblePopCounter
public int getEnemyBubblePopCounter()Gets the enemy bubble pop counter.- Returns:
- the enemy bubble pop counter
-