Package cs.eng1.piazzapanic.stations
Class ChoppingStation
- java.lang.Object
-
- com.badlogic.gdx.scenes.scene2d.Actor
-
- cs.eng1.piazzapanic.stations.Station
-
- cs.eng1.piazzapanic.stations.ChoppingStation
-
-
Field Summary
Fields Modifier and Type Field Description protected Ingredient
currentIngredient
protected float
timeChopped
protected float
totalTimeToChop
protected Ingredient[]
validIngredients
-
Fields inherited from class cs.eng1.piazzapanic.stations.Station
actionAlignment, chefSubjects, id, inUse, nearbyChef, stationImage, uiController
-
-
Constructor Summary
Constructors Constructor Description ChoppingStation(int id, com.badlogic.gdx.graphics.g2d.TextureRegion image, StationUIController uiController, StationActionUI.ActionAlignment alignment, Ingredient[] ingredients)
The constructor method for the class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
act(float delta)
Called every frame.void
doStationAction(StationAction.ActionType action)
Given an action, the station should attempt to do that action based on the chef that is nearby or the state of the ingredient currently on the station.void
draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
Displays ingredients that have been placed on the stationjava.util.List<StationAction.ActionType>
getActionTypes()
Obtains the actions that can be currently performed depending on the states of the station itself and the selected chefvoid
reset()
Reset the station values to be the default.-
Methods inherited from class cs.eng1.piazzapanic.stations.Station
addSubject, deregisterFromAllSubjects, drawDebug, drawFoodTexture, getActionAlignment, getId, getSubjects, removeSubject, setImageRotation, update
-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront, toString
-
-
-
-
Field Detail
-
validIngredients
protected final Ingredient[] validIngredients
-
currentIngredient
protected Ingredient currentIngredient
-
timeChopped
protected float timeChopped
-
totalTimeToChop
protected final float totalTimeToChop
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChoppingStation
public ChoppingStation(int id, com.badlogic.gdx.graphics.g2d.TextureRegion image, StationUIController uiController, StationActionUI.ActionAlignment alignment, Ingredient[] ingredients)
The constructor method for the class- Parameters:
id
- The unique identifier of the stationimage
- The rectangular area of the textureuiController
- The controller from which we can get show and hide the action buttons belonging to the stationalignment
- Dictates where the action buttons are showningredients
- An array of ingredients used to define what ingredients can be chopped
-
-
Method Detail
-
act
public void act(float delta)
Called every frame. Used to update the progress bar and check if enough time has passed for the ingredient to be changed to its chopped variant- Overrides:
act
in classcom.badlogic.gdx.scenes.scene2d.Actor
- Parameters:
delta
- Time in seconds since the last frame.
-
getActionTypes
public java.util.List<StationAction.ActionType> getActionTypes()
Obtains the actions that can be currently performed depending on the states of the station itself and the selected chef- Overrides:
getActionTypes
in classStation
- Returns:
- actionTypes - the list of actions the station can currently perform.
-
doStationAction
public void doStationAction(StationAction.ActionType action)
Given an action, the station should attempt to do that action based on the chef that is nearby or the state of the ingredient currently on the station.- Overrides:
doStationAction
in classStation
- Parameters:
action
- the action that needs to be done by this station if it can.
-
reset
public void reset()
Description copied from class:Station
Reset the station values to be the default.
-
draw
public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
Displays ingredients that have been placed on the station
-
-