Class ItemComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.items.ItemComponent
All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable

public class ItemComponent extends Component
  • Constructor Details

    • ItemComponent

      public ItemComponent(String itemName, ItemType itemType, String texturePath)
      Constructor for Item
      Parameters:
      itemName - user facing name for item
      itemType - the enum for type of item
      texturePath - path for the item texture
    • ItemComponent

      public ItemComponent(String itemName, ItemType itemType, int price, String texturePath)
      Constructor for Item
      Parameters:
      itemName - user facing name
      itemType - the enum for type of item
      price - sellable price of the item
      texturePath - path for the item texture
    • ItemComponent

      public ItemComponent(String itemName, ItemType itemType, String itemDescription, String texturePath)
      Constructor for Item
      Parameters:
      itemName - user facing name for item
      itemType - the enum for type of item
      itemDescription - user facing description for item
      texturePath - path for the item texture
    • ItemComponent

      public ItemComponent(String itemName, ItemType itemType, String itemDescription, int price, String texturePath)
      Constructor for Item
      Parameters:
      itemName - user facing name for item
      itemType - the enum for type of item
      itemDescription - user facing description for item
      price - price of item
      texturePath - path for the item texture
  • Method Details

    • isPerishable

      public boolean isPerishable()
      Returns if the item is consumable
      Returns:
      boolean whether the item is perishable or not
    • getPrice

      public int getPrice()
      Returns the price of the item
      Returns:
      int price of item
    • setPrice

      public void setPrice(int price)
      Sets the price of the item
      Parameters:
      price - int price of item
    • getItemTexture

      public com.badlogic.gdx.graphics.Texture getItemTexture()
      Returns:
      the texture of the item (Primarily used to the inventory display)
    • setItemTexture

      public void setItemTexture(String texturePath)
      Sets an Item's texture component to a given Texture
      Parameters:
      texturePath - - path of the new item texture
    • isSellable

      public boolean isSellable()
      Returns selalble bool of item
      Returns:
      true if item is sellable, false otherwise
    • getItemName

      public String getItemName()
      Returns the name of the item
      Returns:
      int price of item
    • setItemName

      public void setItemName(String name)
      Sets the item name of the item
      Parameters:
      name - string name of the item
    • getItemId

      public String getItemId()
      Returns the id of the item
      Returns:
      String id of item
    • getItemDescription

      public String getItemDescription()
      Returns the description of the item
      Returns:
      String description of item
    • setItemDescription

      public void setItemDescription(String description)
      Sets the price of the item
      Parameters:
      description - string description of the item
    • getItemType

      public ItemType getItemType()
      Returns the type of the item
      Returns:
      ItemType enum type of item