Package pvzclone.model.impl
Class ZombieImpl
java.lang.Object
pvzclone.model.impl.ZombieImpl
- All Implemented Interfaces:
ActiveEntities,Entities,Zombie
Class that implements Zombie Interface.
-
Constructor Summary
ConstructorsConstructorDescriptionZombieImpl(double damage, long cooldown, int xShift, double maxLife, Pair<Integer, Integer> position) Constructor of Zombies. -
Method Summary
Modifier and TypeMethodDescriptionlongdoublelongdoublebooleanisAlive()booleanisCanGo()voidmoveLeft()Moves Zombie to the left.voidreceiveDamage(double damageReceived) This method decreases Health Points.voidsetCanGo(boolean canGo) Sets the boolean based on whether the Zombie can move or not.voidsetLastTimeAttack(long lastTimeAttack) Sets the respective field.
-
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:
getDamagein interfaceActiveEntities- Returns:
- entity's Attack Damage.
-
getRemainingLife
public double getRemainingLife()- Specified by:
getRemainingLifein interfaceActiveEntities- Returns:
- entity's Health Points.
-
getPosition
- Specified by:
getPositionin interfaceEntities- Returns:
- position of the entity.
-
isAlive
public boolean isAlive() -
getEntityName
- Specified by:
getEntityNamein interfaceEntities- Returns:
- name of the entity.
-
getCooldown
public long getCooldown()- Specified by:
getCooldownin interfaceActiveEntities- Returns:
- time needed to start and finish an attack.
-
receiveDamage
public void receiveDamage(double damageReceived) Description copied from interface:ActiveEntitiesThis method decreases Health Points.- Specified by:
receiveDamagein interfaceActiveEntities- Parameters:
damageReceived- Attack Damage that entity has received.
-
setLastTimeAttack
public void setLastTimeAttack(long lastTimeAttack) Description copied from interface:ActiveEntitiesSets the respective field.- Specified by:
setLastTimeAttackin interfaceActiveEntities- Parameters:
lastTimeAttack- time since the last attack.
-
getLastTimeAttack
public long getLastTimeAttack()- Specified by:
getLastTimeAttackin interfaceActiveEntities- Returns:
- time since the last attack.
-
moveLeft
public void moveLeft()Description copied from interface:ZombieMoves Zombie to the left. -
setCanGo
public void setCanGo(boolean canGo) Description copied from interface:ZombieSets the boolean based on whether the Zombie can move or not. -
isCanGo
public boolean isCanGo()
-