Class EnemyManagerModel
-
Method Summary
Modifier and TypeMethodDescriptionbooleanreturns if all enemies are dead.voidcheckEnemyHit(PlayerModel playerModel, EnemyModel enemyModel) Checks if the player has hit an enemy and handles the interaction.booleanreturns if all enemies have reached their spawn points.intReturns the count of active enemies.intReturns the chronometer value for the time all enemies have been dead.Returns the list of enemy models.static EnemyManagerModelReturns the singleton instance of the EnemyManagerModel.voidLoads the enemies for the current level.voidResets the state of the enemies for a new level.voidResets the state of the class to be ready for a new play.voidSets all active enemies to the hungry state.voidsetChacknHeartfreeze(int timer) This method sets the freeze and invincibility timers to the specified value, enabling the freeze state for enemies and the invincibility mode for the player.voidupdate()Updates the state of all enemies and relevant timers.
-
Method Details
-
getInstance
Returns the singleton instance of the EnemyManagerModel.- Returns:
- the singleton instance
-
update
public void update()Updates the state of all enemies and relevant timers. -
checkEnemyHit
Checks if the player has hit an enemy and handles the interaction.- Parameters:
playerModel- the player modelenemyModel- the enemy model
-
setAllHungry
public void setAllHungry()Sets all active enemies to the hungry state. -
loadEnemies
public void loadEnemies()Loads the enemies for the current level.This method gets the list of enemies from the current level by the LevelManagerModel and saves them in the enemies list.
-
newLevelReset
public void newLevelReset()Resets the state of the enemies for a new level.This method calls the newLevelReset method to clear the list of enemies and reset various flags and timers related to enemy states, such as whether all enemies have reached their spawn points, whether all enemies are dead, the chronometer for the time all enemies have been dead, the freeze state of enemies, and the invincibility mode of the player.
-
newPlayReset
public void newPlayReset()Resets the state of the class to be ready for a new play.This method calls the newLevelReset method to clear the list of enemies and reset various flags and timers related to enemy states, such as whether all enemies have reached their spawn points, whether all enemies are dead, the chronometer for the time all enemies have been dead, the freeze state of enemies, and the invincibility mode of the player.
-
getActiveEnemiesCount
public int getActiveEnemiesCount()Returns the count of active enemies.- Returns:
- the count of active enemies
-
getEnemiesModels
Returns the list of enemy models.- Returns:
- the list of enemy models
-
didAllEnemiesReachedSpawn
public boolean didAllEnemiesReachedSpawn()returns if all enemies have reached their spawn points.- Returns:
- true if all enemies have reached their spawn points, false otherwise
-
setChacknHeartfreeze
public void setChacknHeartfreeze(int timer) This method sets the freeze and invincibility timers to the specified value, enabling the freeze state for enemies and the invincibility mode for the player.This method is used when the player picks up the Chack'n Heart power-up
- Parameters:
timer- the timer value to set for both freeze and invincibility effects
-
getAllEnemiesDeadChronometer
public int getAllEnemiesDeadChronometer()Returns the chronometer value for the time all enemies have been dead.- Returns:
- the chronometer value
-
areAllEnemiesDead
public boolean areAllEnemiesDead()returns if all enemies are dead.- Returns:
- true if all enemies are dead, false otherwise
-