Class Chef

  • All Implemented Interfaces:
    com.badlogic.gdx.utils.Disposable

    public class Chef
    extends com.badlogic.gdx.scenes.scene2d.Actor
    implements com.badlogic.gdx.utils.Disposable
    The Chef class is an actor representing a chef in the kitchen. It can pick up and put down ingredients and interact with stations.
    • Constructor Summary

      Constructors 
      Constructor Description
      Chef​(com.badlogic.gdx.graphics.Texture image, com.badlogic.gdx.math.Vector2 imageBounds, ChefManager chefManager)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void act​(float delta)  
      boolean canGrabIngredient()  
      void dispose()  
      void draw​(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)  
      FixedStack<Ingredient> getStack()  
      com.badlogic.gdx.graphics.Texture getTexture()  
      void grabIngredient​(Ingredient ingredient)  
      boolean hasIngredient()  
      void init​(float x, float y)  
      boolean isInputEnabled()  
      boolean isPaused()  
      void notifyAboutUpdatedStack()
      Whenever the stack has items added or removed from it, notify the chef manager about the new stack.
      Ingredient placeIngredient()
      Pops the top ingredient from the stack to place on the station
      void setInputEnabled​(boolean inputEnabled)  
      void setInputVector​(float x, float y)
      Sets the input vector based on x and y, but ensuring that the vector is never greater than a length of 1
      void setPaused​(boolean pauseValue)  
      • Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

        addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, 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
    • Constructor Detail

      • Chef

        public Chef​(com.badlogic.gdx.graphics.Texture image,
                    com.badlogic.gdx.math.Vector2 imageBounds,
                    ChefManager chefManager)
        Parameters:
        image - the texture to display to the user
        imageBounds - the bounds of the texture independent of the chef's own bounds to use for drawing the image to scale.
        chefManager - the controller from which we can get information about all the chefs and their surrounding environment
    • Method Detail

      • init

        public void init​(float x,
                         float y)
      • draw

        public void draw​(com.badlogic.gdx.graphics.g2d.Batch batch,
                         float parentAlpha)
        Overrides:
        draw in class com.badlogic.gdx.scenes.scene2d.Actor
      • act

        public void act​(float delta)
        Overrides:
        act in class com.badlogic.gdx.scenes.scene2d.Actor
      • hasIngredient

        public boolean hasIngredient()
      • canGrabIngredient

        public boolean canGrabIngredient()
      • grabIngredient

        public void grabIngredient​(Ingredient ingredient)
      • placeIngredient

        public Ingredient placeIngredient()
        Pops the top ingredient from the stack to place on the station
        Returns:
        the ingredient that was popped from the stack.
      • setInputVector

        public void setInputVector​(float x,
                                   float y)
        Sets the input vector based on x and y, but ensuring that the vector is never greater than a length of 1
        Parameters:
        x - the x input value
        y - the y input value
      • isInputEnabled

        public boolean isInputEnabled()
      • setInputEnabled

        public void setInputEnabled​(boolean inputEnabled)
      • isPaused

        public boolean isPaused()
      • setPaused

        public void setPaused​(boolean pauseValue)
      • getTexture

        public com.badlogic.gdx.graphics.Texture getTexture()
      • notifyAboutUpdatedStack

        public void notifyAboutUpdatedStack()
        Whenever the stack has items added or removed from it, notify the chef manager about the new stack.
      • dispose

        public void dispose()
        Specified by:
        dispose in interface com.badlogic.gdx.utils.Disposable