public class LauncherModel extends TraitModel implements Launcher
The ObjectGame
owner must have the following Trait
:
The Configurer
must provide a valid configuration compatible with
LauncherConfig
.
The Services
must provide the following services:
If the ObjectGame
is a LauncherListener
, it will automatically addListener(LauncherListener)
on it.
Constructor and Description |
---|
LauncherModel()
Create a launcher model.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(LauncherListener listener)
Add a launcher listener.
|
void |
fire()
Fire with the specified configuration.
|
void |
fire(Localizable target)
Fire with the specified configuration.
|
int |
getOffsetX()
Get the horizontal offset.
|
int |
getOffsetY()
Get the vertical offset.
|
void |
prepare(ObjectGame owner,
Services services)
Prepare the trait.
|
void |
setOffset(int x,
int y)
Set the launcher position offset.
|
void |
setRate(long rate)
Set the fire rate.
|
getOwner
public void prepare(ObjectGame owner, Services services)
Trait
prepare
in interface Trait
prepare
in class TraitModel
owner
- The owner reference.services
- The services reference.public void addListener(LauncherListener listener)
Launcher
addListener
in interface Launcher
listener
- The launcher listener to add.public void fire()
Launcher
LauncherListener
will be notified with
LauncherListener.notifyFired(com.b3dgs.lionengine.game.object.ObjectGame)
.public void fire(Localizable target)
Launcher
LauncherListener
will be notified with
LauncherListener.notifyFired(com.b3dgs.lionengine.game.object.ObjectGame)
.public void setOffset(int x, int y)
Launcher
Launchable
starting position on fire.public void setRate(long rate)
Launcher
public int getOffsetX()
Launcher
getOffsetX
in interface Launcher
public int getOffsetY()
Launcher
getOffsetY
in interface Launcher
Copyright © 2016 Byron 3D Games Studio. All rights reserved.