T
- The enum containing all projectiles type.E
- The entity type used.E2
- The entity attacker type used.P
- The projectile type used.public abstract class LauncherProjectileGame<T extends Enum<T> & ObjectType,E extends EntityGame,E2 extends Surface,P extends ProjectileGame<E,E2>> extends ObjectGame
Constructor and Description |
---|
LauncherProjectileGame(SetupGame setup,
FactoryObjectGame<T,? extends SetupSurfaceGame,P> factory,
HandlerProjectileGame<E,P> handler)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected P |
addProjectile(T type,
int dmg,
double vecX,
double vecY,
int offX,
int offY)
Add a projectile for the shoot.
|
protected P |
addProjectile(T type,
int dmg,
E target,
double speed,
int offX,
int offY)
Add a projectile for the shoot.
|
protected P |
addProjectile(T type,
int id,
int dmg,
double vecX,
double vecY,
int offX,
int offY)
Add a linked projectile for the shoot.
|
protected P |
addProjectile(T type,
long delay,
int dmg,
double vecX,
double vecY,
int offX,
int offY)
Add a delayed projectile for the shoot.
|
boolean |
canHitOnlyTarget()
Get the hit target only state.
|
int |
getRatePercent()
Get rate shoot percent.
|
boolean |
launch()
Start shoot.
|
boolean |
launch(E target)
Start shoot.
|
protected abstract void |
launchProjectile(E2 owner)
Perform an attack from the owner (called when the launcher fired its projectile(s)).
|
protected abstract void |
launchProjectile(E2 owner,
E target)
Perform an attack from the owner to target (called when the launcher fired its projectile(s)).
|
void |
setAdaptative(boolean adaptative)
Set the adaptative flag.
|
void |
setCanHitTargetOnly(boolean hitTargetOnly)
Set the hit target properties.
|
void |
setOffsetX(int x)
Set global starting projectile horizontal offset.
|
void |
setOffsetY(int y)
Set global starting projectile vertical offset.
|
void |
setOwner(E2 owner)
Set the projectile owner.
|
void |
setRate(int rate)
Set shoot rate (in millisecond).
|
destroy, getDataAnimation, getDataBoolean, getDataCollision, getDataDouble, getDataInteger, getDataRoot, getDataString, getId, isDestroyed, loadData
public final Alterable level
public LauncherProjectileGame(SetupGame setup, FactoryObjectGame<T,? extends SetupSurfaceGame,P> factory, HandlerProjectileGame<E,P> handler)
setup
- The setup reference.factory
- The projectiles factory.handler
- The projectiles handler.protected abstract void launchProjectile(E2 owner)
Use theses functions to add projectiles:
owner
- The owner reference.protected abstract void launchProjectile(E2 owner, E target)
owner
- The owner reference.target
- The target reference.public boolean launch()
true
if shot, false
else.public boolean launch(E target)
target
- The target.true
if shot, false
else.public void setOwner(E2 owner)
owner
- The entity owner.public void setCanHitTargetOnly(boolean hitTargetOnly)
hitTargetOnly
- true
to make the projectile hit only the target, false
to allows
other hits.public void setAdaptative(boolean adaptative)
adaptative
- true
to anticipate target movement, false
else.public void setRate(int rate)
rate
- shoot rate.public void setOffsetX(int x)
x
- horizontal starting shoot offset.public void setOffsetY(int y)
y
- vertical starting shoot offset.public int getRatePercent()
public boolean canHitOnlyTarget()
true
if can hit only the target, false
else.protected P addProjectile(T type, int dmg, E target, double speed, int offX, int offY)
type
- The projectile type.dmg
- The projectile damage.target
- The target to reach.speed
- The projectile speed.offX
- The horizontal projectile location offset.offY
- The vertical projectile location offset.protected P addProjectile(T type, int dmg, double vecX, double vecY, int offX, int offY)
type
- The projectile type.dmg
- The projectile damage.vecX
- The horizontal projectile move.vecY
- The vertical projectile move.offX
- The horizontal projectile location offset.offY
- The vertical projectile location offset.protected P addProjectile(T type, int id, int dmg, double vecX, double vecY, int offX, int offY)
type
- The projectile type.id
- projectile id (when a projectile is destroyed, all projectiles with this id are also destroyed).dmg
- The projectile damage.vecX
- The horizontal projectile move.vecY
- The vertical projectile move.offX
- The horizontal projectile location offset.offY
- The vertical projectile location offset.protected P addProjectile(T type, long delay, int dmg, double vecX, double vecY, int offX, int offY)
type
- The projectile type.delay
- delay before be thrown.dmg
- The projectile damage.vecX
- The horizontal projectile move.vecY
- The vertical projectile move.offX
- The horizontal projectile location offset.offY
- The vertical projectile location offset.Copyright © 2014 Byron 3D Games Studio. All rights reserved.