Class CookingStation

  • All Implemented Interfaces:
    Observer<Chef>

    public class CookingStation
    extends Station
    The CookingStation class is a station representing the place in the kitchen where you cook patties to be used in making burgers.
    • 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 station
      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
      void reset()
      Reset the station values to be the default.
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • validIngredients

        protected final Ingredient[] validIngredients
      • currentIngredient

        protected Ingredient currentIngredient
      • timeCooked

        protected float timeCooked
    • Constructor Detail

      • CookingStation

        public CookingStation​(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 station
        image - The rectangular area of the texture
        uiController - The controller from which we can get show and hide the action buttons belonging to the station
        alignment - Dictates where the action buttons are shown
        ingredients - An array of ingredients used to define what ingredients can be cooked
    • Method Detail

      • reset

        public void reset()
        Description copied from class: Station
        Reset the station values to be the default.
        Overrides:
        reset in class Station
      • 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 half cooked or cooked variant
        Overrides:
        act in class com.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 class Station
        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 class Station
        Parameters:
        action - the action that needs to be done by this station if it can.
      • draw

        public void draw​(com.badlogic.gdx.graphics.g2d.Batch batch,
                         float parentAlpha)
        Displays ingredients that have been placed on the station
        Overrides:
        draw in class Station
        Parameters:
        batch - Used to display a 2D texture
        parentAlpha - The parent alpha, to be multiplied with this actor's alpha, allowing the parent's alpha to affect all children.