Package com.mygdx.auber.entities
Class Infiltrator
- java.lang.Object
-
- com.badlogic.gdx.graphics.g2d.TextureRegion
-
- com.badlogic.gdx.graphics.g2d.Sprite
-
- com.mygdx.auber.entities.NPC
-
- com.mygdx.auber.entities.Infiltrator
-
public final class Infiltrator extends NPC
-
-
Field Summary
Fields Modifier and Type Field Description static intAUBER_DAMAGE_VALUEThe amount to damage Auber by if Auber is to be damaged.
-
Constructor Summary
Constructors Constructor Description Infiltrator(com.badlogic.gdx.graphics.g2d.Sprite sprite, float x, float y, MapGraph mapGraph, boolean isHard)Class constructor.Infiltrator(com.badlogic.gdx.graphics.g2d.Sprite sprite, Node node, MapGraph mapGraph, boolean isHard)Class constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcreateInfiltratorSprites()Fills out the array of sprites available for the infiltrators to take.voiddamageAuber(Player p, int amount)Damages Auber by an amount.voiddestroyKeySystem()Starts destroying a random keySystem, moves towards it, sets isDestroying to true.voiddispose()Called when this object is deleted.static java.lang.Stringencode(com.badlogic.gdx.utils.Array<Infiltrator> infiltrators)Encodes data of all infiltrators into a recognisable string.static com.badlogic.gdx.utils.Array<com.badlogic.gdx.graphics.g2d.Sprite>getEasySprites()Gets the list of easy sprites.static com.badlogic.gdx.utils.Array<com.badlogic.gdx.graphics.g2d.Sprite>getHardSprites()Gets the list of hard sprites.booleangetIsDestroying()Gets if infiltrator is destroying.voidgoInvisible()Sets the sprite alpha to 0, records the time the invisibility started, sets isInvisible to true.booleanisDestroying()Whether this infiltrator is currently destroying a system.static booleanisHighlighted()Whether infiltrators are currently highlighted.static voidloadFromEncoding(java.lang.String coordinate, java.lang.String isDestroying, java.lang.String invisible, java.lang.String timesInvisible)voidreachDestination()Called when the path queue is empty.voidsetDestroying(boolean newIsDestroying)Sets whether this Infiltrator is destroying a system.voidsetHighlight(com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer)Highlights each Infiltrator.voidsetIsDestroying()Sets if infiltrator is destroying.voidsetIsInvisible(boolean newIsInvisible)Sets whether this infiltrator is invisible.voidsetTimeInvisible(float newTimeInvisible)Sets how long this infiltrator has been invisible for.voidstep(Player p, float delta)Step needs to be called in the update method, makes the NPC move and check if it has reached its next node.voidstopAuberHealing(Player p)Sets canHeal to false in player, records the time at which he stopped being able to heal.voiduseAbility(Player p)Causes the infiltrator to use a random ability.-
Methods inherited from class com.mygdx.auber.entities.NPC
checkCollision, clearPathQueue, disposeNPC, getElapsedTime, getIndex, getPathQueue, getPreviousNode, getVelocity, incrementElapsedTime, moveNPC, reachNextNode, render, resetElapsedTime, setGoal, setIndex, setSpeedToNextNode, setVelocity, updateNPC
-
Methods inherited from class com.badlogic.gdx.graphics.g2d.Sprite
draw, draw, flip, getBoundingRectangle, getColor, getHeight, getOriginX, getOriginY, getRotation, getScaleX, getScaleY, getVertices, getWidth, getX, getY, rotate, rotate90, scale, scroll, set, setAlpha, setBounds, setCenter, setCenterX, setCenterY, setColor, setColor, setFlip, setOrigin, setOriginBasedPosition, setOriginCenter, setPackedColor, setPosition, setRegion, setRotation, setScale, setScale, setSize, setU, setU2, setV, setV2, setX, setY, translate, translateX, translateY
-
Methods inherited from class com.badlogic.gdx.graphics.g2d.TextureRegion
getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, split, split
-
-
-
-
Field Detail
-
AUBER_DAMAGE_VALUE
public static final int AUBER_DAMAGE_VALUE
The amount to damage Auber by if Auber is to be damaged.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Infiltrator
public Infiltrator(com.badlogic.gdx.graphics.g2d.Sprite sprite, Node node, MapGraph mapGraph, boolean isHard)Class constructor.- Parameters:
sprite- The sprite used to draw this Infiltrator.node- The Node this infiltrator spawns on.mapGraph- The MapGraph this infiltrator uses to navigate.isHard- Whether this infiltrator uses a hard sprite.
-
Infiltrator
public Infiltrator(com.badlogic.gdx.graphics.g2d.Sprite sprite, float x, float y, MapGraph mapGraph, boolean isHard)Class constructor.- Parameters:
sprite- The sprite used to draw this Infiltrator.x- The x coordinate this infiltrator spawns at.y- The y coordinate this infiltrator spawns at.mapGraph- The MapGraph this infiltrator uses to navigate.isHard- Whether this infiltrator uses a hard sprite.
-
-
Method Detail
-
step
public void step(Player p, float delta)
Step needs to be called in the update method, makes the NPC move and check if it has reached its next node.- Parameters:
p- The instance of the player.delta- The time in seconds since the previous frame.
-
reachDestination
public void reachDestination()
Called when the path queue is empty.- Specified by:
reachDestinationin classNPC
-
destroyKeySystem
public void destroyKeySystem()
Starts destroying a random keySystem, moves towards it, sets isDestroying to true.
-
useAbility
public void useAbility(Player p)
Causes the infiltrator to use a random ability.- Parameters:
p- The current instance of Auber.
-
goInvisible
public void goInvisible()
Sets the sprite alpha to 0, records the time the invisibility started, sets isInvisible to true.
-
damageAuber
public void damageAuber(Player p, int amount)
Damages Auber by an amount.- Parameters:
p- The player to damage.amount- Int amount of damage to deal.
-
stopAuberHealing
public void stopAuberHealing(Player p)
Sets canHeal to false in player, records the time at which he stopped being able to heal.- Parameters:
p- The current instance of the player.
-
createInfiltratorSprites
public static void createInfiltratorSprites()
Fills out the array of sprites available for the infiltrators to take.
-
setHighlight
public void setHighlight(com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer)
Highlights each Infiltrator.- Parameters:
shapeRenderer- The ShapeRenderer used to highlight the Infiltrators.
-
dispose
public void dispose()
Called when this object is deleted.
-
isHighlighted
public static boolean isHighlighted()
Whether infiltrators are currently highlighted.- Returns:
- True if they are, false otherwise.
-
isDestroying
public boolean isDestroying()
Whether this infiltrator is currently destroying a system.- Returns:
- True if they are, false otherwise.
-
setDestroying
public void setDestroying(boolean newIsDestroying)
Sets whether this Infiltrator is destroying a system.- Parameters:
newIsDestroying- Whether this infiltrator should be destroying a system or not.
-
setIsInvisible
public void setIsInvisible(boolean newIsInvisible)
Sets whether this infiltrator is invisible.- Parameters:
newIsInvisible- Whether this infiltrator should be invisible.
-
setTimeInvisible
public void setTimeInvisible(float newTimeInvisible)
Sets how long this infiltrator has been invisible for.- Parameters:
newTimeInvisible- How long this infiltrator has been invisible for.
-
getEasySprites
public static com.badlogic.gdx.utils.Array<com.badlogic.gdx.graphics.g2d.Sprite> getEasySprites()
Gets the list of easy sprites.- Returns:
- the list of easy sprites.
-
getHardSprites
public static com.badlogic.gdx.utils.Array<com.badlogic.gdx.graphics.g2d.Sprite> getHardSprites()
Gets the list of hard sprites.- Returns:
- the list of hard sprites.
-
getIsDestroying
public boolean getIsDestroying()
Gets if infiltrator is destroying. Used for testing.- Returns:
- if this infiltrator is destroying
-
setIsDestroying
public void setIsDestroying()
Sets if infiltrator is destroying. Used for testing ONLY.
-
encode
public static java.lang.String encode(com.badlogic.gdx.utils.Array<Infiltrator> infiltrators)
Encodes data of all infiltrators into a recognisable string.- Parameters:
infiltrators- the set of infiltrators to encode.- Returns:
- the encoded data of the given array of sprites.
-
loadFromEncoding
public static void loadFromEncoding(java.lang.String coordinate, java.lang.String isDestroying, java.lang.String invisible, java.lang.String timesInvisible)- Parameters:
coordinate- The coordinates of the Infiltrators.isDestroying- Whether the Infiltrator is destroying a system.invisible- Whether the Infiltrator is invisible.timesInvisible- How many times this Infiltrator has turned invisible.
-
-