Package cs.eng1.piazzapanic.chef
Class ChefManager
- java.lang.Object
-
- cs.eng1.piazzapanic.chef.ChefManager
-
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
public class ChefManager extends java.lang.Object implements com.badlogic.gdx.utils.DisposableThe controller that handles switching control between chefs and tells them about the surrounding environment.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String[]chefSprites(package private) float[]chefX(package private) float[]chefY
-
Constructor Summary
Constructors Constructor Description ChefManager(float chefScale, com.badlogic.gdx.maps.tiled.TiledMapTileLayer collisionLayer, UIOverlay overlay)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChefsToStage(com.badlogic.gdx.scenes.scene2d.Stage stage)Add the created Chefs to the game worldvoidcurrentChefStackUpdated()Update the UI when the current chef's stack has been updatedvoiddispose()com.badlogic.gdx.maps.tiled.TiledMapTileLayer.CellgetCellAtPosition(int x, int y)Get the tile in the foreground collision layer at the specified pointjava.util.List<Chef>getChefs()ChefgetCurrentChef()voidinit()Reset each chef to their original position when you loadvoidsetCurrentChef(Chef chef)Given a chef, update the state of the chefs to make sure that only one has input enabled.
-
-
-
Constructor Detail
-
ChefManager
public ChefManager(float chefScale, com.badlogic.gdx.maps.tiled.TiledMapTileLayer collisionLayer, UIOverlay overlay)- Parameters:
chefScale- the amount to scale the texture by so that each chef is an accurate size.collisionLayer- the tile map layer which the chefs can collide with.overlay- the user interface overlay to display information about the current chef and time, and to provide more controls.
-
-
Method Detail
-
init
public void init()
Reset each chef to their original position when you load
-
getCellAtPosition
public com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell getCellAtPosition(int x, int y)Get the tile in the foreground collision layer at the specified point- Parameters:
x- the x coordinate of the tiley- the y coordinate of the tile- Returns:
- the cell/tile at the coordinates
-
getChefs
public java.util.List<Chef> getChefs()
-
addChefsToStage
public void addChefsToStage(com.badlogic.gdx.scenes.scene2d.Stage stage)
Add the created Chefs to the game world- Parameters:
stage- The game world to which the chefs should be added.
-
setCurrentChef
public void setCurrentChef(Chef chef)
Given a chef, update the state of the chefs to make sure that only one has input enabled.- Parameters:
chef- the chef to be controlled by the user
-
getCurrentChef
public Chef getCurrentChef()
-
currentChefStackUpdated
public void currentChefStackUpdated()
Update the UI when the current chef's stack has been updated
-
dispose
public void dispose()
- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
-