Class ChainReactionManager

java.lang.Object
model.bubbles.playerBubbles.ChainReactionManager

public class ChainReactionManager extends Object
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 Details

    • ChainReactionManager

      public ChainReactionManager(PlayerModel playerModel, PlayerBubbleModel firstPoppedBubble, LinkedList<PlayerBubbleModel> bubbles)
      Constructs a new ChainReactionManager.
      Parameters:
      playerModel - the player model
      firstPoppedBubble - the first bubble popped
      bubbles - the list of bubbles
  • Method Details

    • chainExplosion

      public void chainExplosion(PlayerBubbleModel poppedBubble)
      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