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
ConstructorDescriptionZombieImpl
(double damage, long cooldown, int xShift, double maxLife, Pair<Integer, Integer> position) Constructor of Zombies. -
Method Summary
Modifier and TypeMethodDescriptionlong
double
long
double
boolean
isAlive()
boolean
isCanGo()
void
moveLeft()
Moves Zombie to the left.void
receiveDamage
(double damageReceived) This method decreases Health Points.void
setCanGo
(boolean canGo) Sets the boolean based on whether the Zombie can move or not.void
setLastTimeAttack
(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:
getDamage
in interfaceActiveEntities
- Returns:
- entity's Attack Damage.
-
getRemainingLife
public double getRemainingLife()- Specified by:
getRemainingLife
in interfaceActiveEntities
- Returns:
- entity's Health Points.
-
getPosition
- Specified by:
getPosition
in interfaceEntities
- Returns:
- position of the entity.
-
isAlive
public boolean isAlive() -
getEntityName
- Specified by:
getEntityName
in interfaceEntities
- Returns:
- name of the entity.
-
getCooldown
public long getCooldown()- Specified by:
getCooldown
in interfaceActiveEntities
- 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 interfaceActiveEntities
- 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 interfaceActiveEntities
- Parameters:
lastTimeAttack
- time since the last attack.
-
getLastTimeAttack
public long getLastTimeAttack()- Specified by:
getLastTimeAttack
in interfaceActiveEntities
- Returns:
- time since the last attack.
-
moveLeft
public void moveLeft()Description copied from interface:Zombie
Moves Zombie to the left. -
setCanGo
public void setCanGo(boolean canGo) Description copied from interface:Zombie
Sets the boolean based on whether the Zombie can move or not. -
isCanGo
public boolean isCanGo()
-