Class Infiltrator


  • public final class Infiltrator
    extends NPC
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int AUBER_DAMAGE_VALUE
      The amount to damage Auber by if Auber is to be damaged.
      • Fields inherited from class com.mygdx.auber.entities.NPC

        mapGraph
    • 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 void createInfiltratorSprites()
      Fills out the array of sprites available for the infiltrators to take.
      void damageAuber​(Player p, int amount)
      Damages Auber by an amount.
      void destroyKeySystem()
      Starts destroying a random keySystem, moves towards it, sets isDestroying to true.
      void dispose()
      Called when this object is deleted.
      static java.lang.String encode​(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.
      boolean getIsDestroying()
      Gets if infiltrator is destroying.
      void goInvisible()
      Sets the sprite alpha to 0, records the time the invisibility started, sets isInvisible to true.
      boolean isDestroying()
      Whether this infiltrator is currently destroying a system.
      static boolean isHighlighted()
      Whether infiltrators are currently highlighted.
      static void loadFromEncoding​(java.lang.String coordinate, java.lang.String isDestroying, java.lang.String invisible, java.lang.String timesInvisible)  
      void reachDestination()
      Called when the path queue is empty.
      void setDestroying​(boolean newIsDestroying)
      Sets whether this Infiltrator is destroying a system.
      void setHighlight​(com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer)
      Highlights each Infiltrator.
      void setIsDestroying()
      Sets if infiltrator is destroying.
      void setIsInvisible​(boolean newIsInvisible)
      Sets whether this infiltrator is invisible.
      void setTimeInvisible​(float newTimeInvisible)
      Sets how long this infiltrator has been invisible for.
      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.
      void stopAuberHealing​(Player p)
      Sets canHeal to false in player, records the time at which he stopped being able to heal.
      void useAbility​(Player p)
      Causes the infiltrator to use a random ability.
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
        reachDestination in class NPC
      • 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.