Package pvzclone.controller.api
Interface Controller
- All Known Implementing Classes:
ControllerImpl
public interface Controller
This interface models a Controller for the game.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Calls the main loop of the game.void
chooseLevel
(int numberOfTheLevel) Sets the number of the Level to the number of the argument passed.Retrieves the number of the chosen level if the level was chosen, if not it returns an empty Optional.Retrieves the set of entities in the game.int
Returns the number of levels available in the application.int
Retrieves the points from the GameState.void
Increases the points obtained by the suns in GameState.void
this method communicates with the model telling him the position of the new plant.
-
Method Details
-
callMainloop
void callMainloop()Calls the main loop of the game. This method should be called after the game is initialized. -
getEntities
Retrieves the set of entities in the game. Entities represent the elements present in the game world.- Returns:
- a Set of Entities representing the elements in the game world.
-
newPlant
this method communicates with the model telling him the position of the new plant.- Parameters:
pos
- is the position of the new plant.
-
increaseSunPoints
void increaseSunPoints()Increases the points obtained by the suns in GameState. -
getSunScore
int getSunScore()Retrieves the points from the GameState.- Returns:
- points obtained at the moment.
-
chooseLevel
void chooseLevel(int numberOfTheLevel) Sets the number of the Level to the number of the argument passed.- Parameters:
numberOfTheLevel
- level index.
-
getChosenLevel
Retrieves the number of the chosen level if the level was chosen, if not it returns an empty Optional.- Returns:
- number of the level that we chose.
-
getLevelCount
int getLevelCount()Returns the number of levels available in the application.- Returns:
- number of levels available in the application.
-