Package com.prineside.tdi2
Class EnemyFollowingProjectile
java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.Projectile
com.prineside.tdi2.EnemyFollowingProjectile
- All Implemented Interfaces:
Pool.Poolable
,KryoSerializable
- Direct Known Subclasses:
AirProjectile
,BasicProjectile
,BuffProjectile
,EnemyFollowingExplosiveProjectile
,VenomProjectile
A regular projectile which constantly follows the target enemy.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.prineside.tdi2.Projectile
Projectile.Factory<T extends Projectile>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final float
static final float
float
float
Max rotation speed in deg/sfloat
By how many deg/s the projectile's rotation speed increases per second (becomes more agile with time)static final float
static final float
float
Projectile speed in px/sFields inherited from class com.prineside.tdi2.Projectile
id, position, type
Fields inherited from class com.prineside.tdi2.Registrable
S
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyDrawInterpolation
(float interpolatedTime) void
void
flyOnEnemy
(Enemy enemy) Make projectile fly towards an enemy (some projectile types, such as Laser, do not implement this method)float
boolean
boolean
isDone()
void
void
reset()
Resets the object for reuse.void
void
Remove the reference to the game state and mark this object as not registered.toString()
void
update
(float deltaTime) void
Methods inherited from class com.prineside.tdi2.Projectile
getDamage, hit, multiplyDamage, onDone, setDamage, setup
Methods inherited from class com.prineside.tdi2.Registrable
isRegistered, setRegistered
-
Field Details
-
RAYCAST_INTERVAL_FOLLOWING_MIN
public static final float RAYCAST_INTERVAL_FOLLOWING_MIN- See Also:
-
RAYCAST_INTERVAL_FOLLOWING_MIN_SQR
public static final float RAYCAST_INTERVAL_FOLLOWING_MIN_SQR- See Also:
-
DEFAULT_MAX_ROT_SPEED
public static final float DEFAULT_MAX_ROT_SPEED- See Also:
-
DEFAULT_MAX_ROT_SPEED_DYNAMIC
public static final float DEFAULT_MAX_ROT_SPEED_DYNAMIC- See Also:
-
speed
public float speedProjectile speed in px/s -
maxRotationSpeed
public float maxRotationSpeedMax rotation speed in deg/s -
maxRotationSpeedDynamic
public float maxRotationSpeedDynamicBy how many deg/s the projectile's rotation speed increases per second (becomes more agile with time) -
drawPosition
-
drawAngle
public float drawAngle
-
-
Method Details
-
write
- Specified by:
write
in interfaceKryoSerializable
- Overrides:
write
in classProjectile
-
read
- Specified by:
read
in interfaceKryoSerializable
- Overrides:
read
in classProjectile
-
getTimeExists
public float getTimeExists() -
getTarget
- Returns:
- null if no target / target is unregistered (no need to check for Enemy.isRegistered())
-
setTarget
-
applyDrawInterpolation
public void applyDrawInterpolation(float interpolatedTime) - Specified by:
applyDrawInterpolation
in classProjectile
-
flyOnEnemy
Description copied from class:Projectile
Make projectile fly towards an enemy (some projectile types, such as Laser, do not implement this method)- Overrides:
flyOnEnemy
in classProjectile
-
setUnregistered
public void setUnregistered()Description copied from class:Registrable
Remove the reference to the game state and mark this object as not registered.- Overrides:
setUnregistered
in classRegistrable
-
reset
public void reset()Description copied from interface:com.badlogic.gdx.utils.Pool.Poolable
Resets the object for reuse. Object references should be nulled and fields may be set to default values.- Specified by:
reset
in interfacePool.Poolable
- Overrides:
reset
in classProjectile
-
getPosition
- Overrides:
getPosition
in classProjectile
-
draw
- Specified by:
draw
in classProjectile
-
update
public void update(float deltaTime) - Specified by:
update
in classProjectile
-
isDone
public boolean isDone()- Specified by:
isDone
in classProjectile
- Returns:
- true if projectile has done its job, no longer needed and can be removed from the system
-
hasReachedTarget
public boolean hasReachedTarget()- Specified by:
hasReachedTarget
in classProjectile
-
toString
- Overrides:
toString
in classProjectile
-