Package com.mygdx.game.Components
Class Pirate
java.lang.Object
com.mygdx.game.Components.Component
com.mygdx.game.Components.Pirate
public class Pirate extends Component
Gives the concepts of health plunder, etc. Allows for firing of cannonballs, factions, death, targets
-
Field Summary
Fields Modifier and Type Field Description protected booleanisAliveFields inherited from class com.mygdx.game.Components.Component
parent, reqsMet, requirements, type -
Constructor Summary
Constructors Constructor Description Pirate() -
Method Summary
Modifier and Type Method Description voidaddPlunder(int money)voidaddTarget(Ship target)booleancanAttack()if dst to target is less than attack range target will be null if not in agro rangeintgetAmmo()FactiongetFaction()intgetHealth()intgetPlunder()ShipgetTarget()QueueFIFO<Ship>getTargets()booleanisAgro()if dst to target is >= attack range target will be null if not in agro rangebooleanisAlive()voidkill()Kill its selfvoidreload(int ammo)Adds ammovoidremoveTarget()voidsetAmmo(int ammo)voidsetFactionId(int factionId)voidshoot(com.badlogic.gdx.math.Vector2 dir)Will shoot a cannonball assigning this.parent as the cannonball's parent (must be Ship atm)voidtakeDamage(float dmg)inttargetCount()Methods inherited from class com.mygdx.game.Components.Component
awake, cleanUp, getParent, getType, render, setParent, setRequirements, start, updateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
isAlive
protected boolean isAlive
-
-
Constructor Details
-
Pirate
public Pirate()
-
-
Method Details
-
addTarget
-
getPlunder
public int getPlunder() -
addPlunder
public void addPlunder(int money) -
getFaction
-
setFactionId
public void setFactionId(int factionId) -
takeDamage
public void takeDamage(float dmg) -
shoot
public void shoot(com.badlogic.gdx.math.Vector2 dir)Will shoot a cannonball assigning this.parent as the cannonball's parent (must be Ship atm)- Parameters:
dir- the direction to shoot in
-
reload
public void reload(int ammo)Adds ammo- Parameters:
ammo- amount to add
-
getHealth
public int getHealth() -
canAttack
public boolean canAttack()if dst to target is less than attack range target will be null if not in agro range -
isAgro
public boolean isAgro()if dst to target is >= attack range target will be null if not in agro range -
getTarget
-
removeTarget
public void removeTarget() -
isAlive
public boolean isAlive() -
kill
public void kill()Kill its self -
setAmmo
public void setAmmo(int ammo) -
getAmmo
public int getAmmo() -
targetCount
public int targetCount() -
getTargets
-