Package model.levels
Class LevelManagerModel
java.lang.Object
model.levels.LevelManagerModel
Manages the
Level in the game.
This singleton class is responsible for loading, managing, and transitioning between levels. It keeps track of the current level, handles level transitions, and provides access to level data.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if all levels are completed.static LevelManagerModelReturns the singleton instance of the LevelManagerModel.intReturns the current level index.Returns the list of all levels.int[][]Returns the level tiles tpe data of the current level.getLevelWithIndex(int levelIndex) Returns the level associated to the specified index.Returns the wind direction data of the current level.voidIncreases the level index by one.voidLoads the next level and sets the game state to level transition.voidResets the game to the first level and resets all levels.
-
Method Details
-
getInstance
Returns the singleton instance of the LevelManagerModel.If the instance is null, it initializes the LevelManagerModel instance.
- Returns:
- the singleton instance of the LevelManagerModel
-
loadNextLevel
public void loadNextLevel()Loads the next level and sets the game state to level transition.If the current level is the last level, sets allLevelsCompleted to true.
-
newPlayReset
public void newPlayReset()Resets the game to the first level and resets all levels. -
getCurrentLevel
- Returns:
- the current level
-
getLevelTileData
public int[][] getLevelTileData()Returns the level tiles tpe data of the current level.- Returns:
- a 2D array representing the tiles in map
-
getWindDirectionData
Returns the wind direction data of the current level.- Returns:
- a 2D array representing the wind direction data
-
getLevelWithIndex
Returns the level associated to the specified index.- Parameters:
levelIndex- the index of the level to get- Returns:
- the level associated to the specified index
-
increaseLevelIndex
public void increaseLevelIndex()Increases the level index by one. -
areAllLevelsCompleted
public boolean areAllLevelsCompleted()Checks if all levels are completed.- Returns:
- true if all levels are completed, false otherwise
-
getLevels
Returns the list of all levels.- Returns:
- an ArrayList of all levels
-
getLevelIndex
public int getLevelIndex()Returns the current level index.- Returns:
- the current level index
-