Package model.bubbles.playerBubbles
Class PlayerBubblesManagerModel
java.lang.Object
model.bubbles.playerBubbles.PlayerBubblesManagerModel
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 Summary
Modifier and TypeMethodDescriptionvoidaddBubble(PlayerBubbleModel bubble) Adds a new bubble to the list of bubbles.voidcreateEmptyBubble(float x, float y, Constants.Direction direction) Creates and adds a new empty bubble at the specified position and direction.voidcreateEnemyBubble(EnemyModel e, PlayerModel playerModel) Creates and adds a new enemy bubble to the list of bubbles.static PlayerBubblesManagerModelReturns the singleton instance of the PlayerBubblesManagerModel.intvoidResets the state for a new level.voidResets the state for a new play.voidstartChainReaction(PlayerBubbleModel firstPoppedBubble) Starts a chain reaction from the first popped bubble, chain reaction handled by theChainReactionManager.voidupdate()Updates all active bubbles and checks for collisions with the player.
-
Method Details
-
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
Starts a chain reaction from the first popped bubble, chain reaction handled by theChainReactionManager.- 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
Adds a new bubble to the list of bubbles.- Parameters:
bubble- the bubble to add
-
createEmptyBubble
Creates and adds a new empty bubble at the specified position and direction.- Parameters:
x- the x coordinatey- the y coordinatedirection- the direction
-
createEnemyBubble
Creates and adds a new enemy bubble to the list of bubbles.- Parameters:
e- the enemy modelplayerModel- the player model
-
getBubblesModels
-
getPopTimer
public int getPopTimer()
-