R
- The resources enum type used.public class ExtractorModel<R extends java.lang.Enum<R>> extends AbilityModel<ExtractorListener<R>,ExtractorUsedServices<R>> implements ExtractorServices<R>, ExtractorListener<R>
Constructor and Description |
---|
ExtractorModel(ExtractorUsedServices<R> user,
int desiredFps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
com.b3dgs.lionengine.game.Tiled |
getResourceLocation()
Get the resource location in tile.
|
R |
getResourceType()
Get resource type.
|
boolean |
isExtracting()
Check if extractor is currently working on extraction.
|
void |
notifyDroppedOff(R type,
int droppedQuantity)
Notify listener when extractor has dropped resources to warehouse.
|
void |
notifyExtracted(R type,
int currentQuantity)
Notify listener when extractor extracted one unit (called once when one quantity is extracted).
|
void |
notifyStartCarry(R type,
int totalQuantity)
Notify listener when extractor is going to start carry (called once).
|
void |
notifyStartDropOff(R type,
int totalQuantity)
Notify listener when extractor carried and will start to drop off resources (called once).
|
void |
notifyStartExtraction(R type,
com.b3dgs.lionengine.game.Tiled resourceLocation)
Notify listener when extractor is going to start extraction (called once).
|
void |
notifyStartGoToRessources(R type,
com.b3dgs.lionengine.game.Tiled resourceLocation)
Notify listener when extractor will start to move to resources (called once).
|
void |
setResource(Extractible<R> entity)
Set the resources location in tile.
|
void |
setResource(R type,
int tx,
int ty,
int tw,
int th)
Set the resources location in tile.
|
void |
startExtraction()
Start extraction.
|
void |
stopExtraction()
Stop any action related to extraction.
|
void |
updateExtraction(double extrp)
Update extraction (extract and go back).
|
addListener, removeListener
public ExtractorModel(ExtractorUsedServices<R> user, int desiredFps)
user
- The concerned worker reference.desiredFps
- The the desired frame rate.public void updateExtraction(double extrp)
ExtractorServices
updateExtraction
in interface ExtractorServices<R extends java.lang.Enum<R>>
extrp
- The extrapolation value.public void startExtraction()
ExtractorServices
startExtraction
in interface ExtractorServices<R extends java.lang.Enum<R>>
public void stopExtraction()
ExtractorServices
stopExtraction
in interface ExtractorServices<R extends java.lang.Enum<R>>
public boolean isExtracting()
ExtractorServices
isExtracting
in interface ExtractorServices<R extends java.lang.Enum<R>>
true
if extracting, false
else.public void setResource(Extractible<R> entity)
ExtractorServices
setResource
in interface ExtractorServices<R extends java.lang.Enum<R>>
entity
- The extractible entity.public void setResource(R type, int tx, int ty, int tw, int th)
ExtractorServices
setResource
in interface ExtractorServices<R extends java.lang.Enum<R>>
type
- The resource type to extract.tx
- The horizontal tile.ty
- The vertical tile.tw
- The width in tile.th
- The height in tile.public com.b3dgs.lionengine.game.Tiled getResourceLocation()
ExtractorServices
getResourceLocation
in interface ExtractorServices<R extends java.lang.Enum<R>>
public R getResourceType()
ExtractorServices
getResourceType
in interface ExtractorServices<R extends java.lang.Enum<R>>
public void notifyStartGoToRessources(R type, com.b3dgs.lionengine.game.Tiled resourceLocation)
ExtractorListener
notifyStartGoToRessources
in interface ExtractorListener<R extends java.lang.Enum<R>>
type
- The resource type.resourceLocation
- The resource location.public void notifyStartExtraction(R type, com.b3dgs.lionengine.game.Tiled resourceLocation)
ExtractorListener
notifyStartExtraction
in interface ExtractorListener<R extends java.lang.Enum<R>>
type
- The resource type.resourceLocation
- The resource location.public void notifyExtracted(R type, int currentQuantity)
ExtractorListener
notifyExtracted
in interface ExtractorListener<R extends java.lang.Enum<R>>
type
- The resource type.currentQuantity
- The current quantity of extracted resources.public void notifyStartCarry(R type, int totalQuantity)
ExtractorListener
notifyStartCarry
in interface ExtractorListener<R extends java.lang.Enum<R>>
type
- The resource type.totalQuantity
- The total resource quantity to carry.public void notifyStartDropOff(R type, int totalQuantity)
ExtractorListener
notifyStartDropOff
in interface ExtractorListener<R extends java.lang.Enum<R>>
type
- The resource type.totalQuantity
- The total resource quantity to drop.public void notifyDroppedOff(R type, int droppedQuantity)
ExtractorListener
notifyDroppedOff
in interface ExtractorListener<R extends java.lang.Enum<R>>
type
- The resource type.droppedQuantity
- The total resource quantity dropped off.