Advertisement
Zerewa

Untitled

Apr 8th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. public abstract class Plant{
  2.  
  3. public int age;
  4. public boolean isInfested;
  5. public boolean isBurning;
  6. public int plantPrice;
  7. public int maxAge;
  8.  
  9. public Plant(Player player){
  10.     this.age = 0;
  11.     this.isInfested = false;
  12.     this.isBurning = false;
  13.     player.money -= this.plantPrice;
  14. }
  15.  
  16. public void aging(){
  17.     if (this.age < this.maxAge){
  18.         ++this.age;
  19.     }
  20. }
  21.  
  22. public void setFire(){
  23.     this.isBurning = true;
  24. }
  25.  
  26. public void setInfested(){
  27.     this.isInfested = true;
  28. }
  29.  
  30. public boolean harvested(){
  31.     return (!isBurning && !isInfested && this.age == this.maxAge);
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement