MinusStepsValues.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package pathgame.gameplay;
  2. /**
  3. * A container for holding an energy cost from the step of the player with a
  4. * lifetime for showing in the HUD
  5. *
  6. * @author julia
  7. */
  8. public class MinusStepsValues
  9. {
  10. private final int minusValue;
  11. private int lifeTime = 0;
  12. /**
  13. * Contructor initializing a new energyCost with a lifetime
  14. *
  15. * @param minusValue energyCost of a step of the player
  16. */
  17. public MinusStepsValues(int minusValue)
  18. {
  19. this.minusValue = minusValue;
  20. }
  21. /**
  22. * Returns the energyCost value
  23. *
  24. * @return energyCost value
  25. */
  26. public int getValue()
  27. {
  28. return minusValue;
  29. }
  30. /**
  31. * Returns the energyCost lifetime
  32. *
  33. * @return energyCost lifetime
  34. */
  35. public int getLifeTime()
  36. {
  37. return lifeTime;
  38. }
  39. /**
  40. * Recalculates the lifetime every gametick and returns if energyCost is
  41. * still alive
  42. *
  43. * @return if energyCost is still alive
  44. */
  45. public boolean tick()
  46. {
  47. lifeTime++;
  48. return lifeTime >= 10;
  49. }
  50. }