Package com.prineside.tdi2
Class EnemyGroup
java.lang.Object
com.prineside.tdi2.EnemyGroup
- All Implemented Interfaces:
KryoSerializable
- Direct Known Subclasses:
EnemyGroup.SpawnEnemyGroup
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEnemyGroup
(EnemyType type, float speed, float health, int count, float delay, float interval, float bounty, float killExp, int killScore) -
Method Summary
Modifier and TypeMethodDescriptioncpy()
createSpawnPortion
(int count) static EnemyGroup
int
getSpawnCountByTime
(float timeShift) int
void
void
setEnemyType
(EnemyType type) void
toString()
void
-
Field Details
-
speed
public float speed -
health
public float health -
delay
public float delay -
interval
public float interval -
bounty
public float bountyCoin 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 enemyspeed
- enemy speed, set directlyhealth
- starting and max HP of an enemycount
- number of enemies in the groupdelay
- seconds until the first enemy spawnsinterval
- at which interval in seconds each subsequent enemy spawnsbounty
- number of coins given for killing an enemy. Fractional part determines the chance of receiving +1 coinkillExp
- amount of XP for killing the enemy, affected by multipliers set in Config
-
-
Method Details
-
write
- Specified by:
write
in interfaceKryoSerializable
-
read
- Specified by:
read
in interfaceKryoSerializable
-
getEnemyType
-
setEnemyType
-
getSpawnedCount
public int getSpawnedCount() -
cpy
-
createSpawnPortion
-
toJson
-
fromJson
-
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
-