Class Currency

java.lang.Object
com.csse3200.game.currency.Currency
Direct Known Subclasses:
Crystal, Scrap

public abstract class Currency extends Object
  • Constructor Details

    • Currency

      public Currency(String logoFilePath, String name)
      Constructor for the currency object.
      Parameters:
      logoFilePath - the file path of the logo
  • Method Details

    • getName

      public String getName()
    • getAmount

      public int getAmount()
    • setAmount

      public void setAmount(int amount)
    • getTexture

      public String getTexture()
      Getter for the logo of the currency.
      Returns:
      the logo of the currency in a Texture format.
    • modify

      public void modify(int addedAmount)
      This method increments the currency amount by a given amount. Added amount is assumed to be larger than negative the currency's amount.
      Parameters:
      addedAmount - The amount the currency will be incremented by.
      Requires:
      addedAmount >= -this.amount
    • canBuy

      public boolean canBuy(int cost)
      Checks if you can buy some item with a given cost.
      Parameters:
      cost - the cost of the item.
      Returns:
      boolean representing if you can buy that object or not.
    • toString

      public String toString()
      Overrides:
      toString in class Object