Class EnemyGroup

java.lang.Object
com.prineside.tdi2.EnemyGroup
All Implemented Interfaces:
KryoSerializable
Direct Known Subclasses:
EnemyGroup.SpawnEnemyGroup

public class EnemyGroup extends Object implements KryoSerializable
  • Field Details

    • speed

      public float speed
    • health

      public float health
    • delay

      public float delay
    • interval

      public float interval
    • bounty

      public float bounty
      Coin reward for killing an enemy. Fractional part determines a chance to receive +1 coin (2.5 = 2 coins + 50% to get an extra coin)
    • killExp

      public float killExp
    • killScore

      public int killScore
    • count

      public int count
  • Constructor Details

    • EnemyGroup

      public EnemyGroup(EnemyType type, float speed, float health, int count, float delay, float interval, float bounty, float killExp, int killScore)
      Parameters:
      type - type of an enemy
      speed - enemy speed, set directly
      health - starting and max HP of an enemy
      count - number of enemies in the group
      delay - seconds until the first enemy spawns
      interval - at which interval in seconds each subsequent enemy spawns
      bounty - number of coins given for killing an enemy. Fractional part determines the chance of receiving +1 coin
      killExp - amount of XP for killing the enemy, affected by multipliers set in Config
  • Method Details

    • write

      public void write(Kryo kryo, Output output)
      Specified by:
      write in interface KryoSerializable
    • read

      public void read(Kryo kryo, Input input)
      Specified by:
      read in interface KryoSerializable
    • getEnemyType

      public EnemyType getEnemyType()
    • setEnemyType

      public void setEnemyType(EnemyType type)
    • getSpawnedCount

      public int getSpawnedCount()
    • cpy

      public EnemyGroup cpy()
    • createSpawnPortion

      public EnemyGroup.SpawnEnemyGroup createSpawnPortion(int count)
    • toJson

      public void toJson(Json json)
    • fromJson

      public static EnemyGroup fromJson(JsonValue jsonValue)
    • getSpawnCountByTime

      public int getSpawnCountByTime(float timeShift)
      Parameters:
      timeShift - seconds till the moment the group has started spawning
      Returns:
      number of enemies that had to be spawned at this time If returns a value which is equal to EnemyGroup.count, all enemies of this group must already be spawned
    • toString

      public String toString()
      Overrides:
      toString in class Object