Class ZombieImpl

java.lang.Object
pvzclone.model.impl.ZombieImpl
All Implemented Interfaces:
ActiveEntities, Entities, Zombie

public final class ZombieImpl extends Object implements Zombie
Class that implements Zombie Interface.
  • Constructor Details

    • ZombieImpl

      public ZombieImpl(double damage, long cooldown, int xShift, double maxLife, Pair<Integer,Integer> position)
      Constructor of Zombies.
      Parameters:
      damage - damage that Zombie causes with each bite.
      cooldown - time needed to start and finish a bite.
      xShift - speed of the Zombie.
      maxLife - Zombie's inital life.
      position - Zombie's position.
  • Method Details

    • getDamage

      public double getDamage()
      Specified by:
      getDamage in interface ActiveEntities
      Returns:
      entity's Attack Damage.
    • getRemainingLife

      public double getRemainingLife()
      Specified by:
      getRemainingLife in interface ActiveEntities
      Returns:
      entity's Health Points.
    • getPosition

      public Pair<Integer,Integer> getPosition()
      Specified by:
      getPosition in interface Entities
      Returns:
      position of the entity.
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface Entities
      Returns:
      life state of the entity.
    • getEntityName

      public String getEntityName()
      Specified by:
      getEntityName in interface Entities
      Returns:
      name of the entity.
    • getCooldown

      public long getCooldown()
      Specified by:
      getCooldown in interface ActiveEntities
      Returns:
      time needed to start and finish an attack.
    • receiveDamage

      public void receiveDamage(double damageReceived)
      Description copied from interface: ActiveEntities
      This method decreases Health Points.
      Specified by:
      receiveDamage in interface ActiveEntities
      Parameters:
      damageReceived - Attack Damage that entity has received.
    • setLastTimeAttack

      public void setLastTimeAttack(long lastTimeAttack)
      Description copied from interface: ActiveEntities
      Sets the respective field.
      Specified by:
      setLastTimeAttack in interface ActiveEntities
      Parameters:
      lastTimeAttack - time since the last attack.
    • getLastTimeAttack

      public long getLastTimeAttack()
      Specified by:
      getLastTimeAttack in interface ActiveEntities
      Returns:
      time since the last attack.
    • moveLeft

      public void moveLeft()
      Description copied from interface: Zombie
      Moves Zombie to the left.
      Specified by:
      moveLeft in interface Zombie
    • setCanGo

      public void setCanGo(boolean canGo)
      Description copied from interface: Zombie
      Sets the boolean based on whether the Zombie can move or not.
      Specified by:
      setCanGo in interface Zombie
      Parameters:
      canGo - true if Zombie can move, false otherwise.
    • isCanGo

      public boolean isCanGo()
      Specified by:
      isCanGo in interface Zombie
      Returns:
      boolean canGo, which tells us if Zombie can move or not.