Class PlayerBubblesManagerModel

java.lang.Object
model.bubbles.playerBubbles.PlayerBubblesManagerModel

public class PlayerBubblesManagerModel extends Object
Manages the bubbles created by the player.

This singleton class is responsible for updating the state of player bubbles, handling collisions, and managing chain explosions. It maintains a list of active bubbles and provides methods to add new bubbles, reset the state for new levels or plays, and start chain explosions.

  • Method Details

    • getInstance

      public static PlayerBubblesManagerModel getInstance()
      Returns the singleton instance of the PlayerBubblesManagerModel.
      Returns:
      the singleton instance
    • update

      public void update()
      Updates all active bubbles and checks for collisions with the player.
    • startChainReaction

      public void startChainReaction(PlayerBubbleModel firstPoppedBubble)
      Starts a chain reaction from the first popped bubble, chain reaction handled by the ChainReactionManager.
      Parameters:
      firstPoppedBubble - the first bubble that was popped
    • newLevelReset

      public void newLevelReset()
      Resets the state for a new level.
    • newPlayReset

      public void newPlayReset()
      Resets the state for a new play.
    • addBubble

      public void addBubble(PlayerBubbleModel bubble)
      Adds a new bubble to the list of bubbles.
      Parameters:
      bubble - the bubble to add
    • createEmptyBubble

      public void createEmptyBubble(float x, float y, Constants.Direction direction)
      Creates and adds a new empty bubble at the specified position and direction.
      Parameters:
      x - the x coordinate
      y - the y coordinate
      direction - the direction
    • createEnemyBubble

      public void createEnemyBubble(EnemyModel e, PlayerModel playerModel)
      Creates and adds a new enemy bubble to the list of bubbles.
      Parameters:
      e - the enemy model
      playerModel - the player model
    • getBubblesModels

      public LinkedList<PlayerBubbleModel> getBubblesModels()
    • getPopTimer

      public int getPopTimer()