public class ExtractorModel extends FeatureModel implements Extractor, Recyclable
Constructor and Description |
---|
ExtractorModel(Services services)
Create an extractor model.
|
Modifier and Type | Method and Description |
---|---|
protected void |
actionDropingOff(double extrp)
Action called from update extraction in drop off state.
|
protected void |
actionExtracting(double extrp)
Action called from update extraction in extract state.
|
protected void |
actionGoingToResources()
Action called from update extraction in goto resource state.
|
protected void |
actionGoingToWarehouse()
Action called from update extraction in goto warehouse state.
|
void |
addListener(ExtractorListener listener)
Add an extractor listener.
|
void |
checkListener(Object listener)
Check object interface listening and add them automatically.
|
double |
getDropOffPerSecond()
Get the drop off unit per second.
|
int |
getExtractionCapacity()
Get the extraction capacity in unit (the maximum number of unit extractible per extraction).
|
double |
getExtractionPerSecond()
Get the extraction unit per second.
|
Tiled |
getResourceLocation()
Get the resource location in tile.
|
Enum<?> |
getResourceType()
Get resource type.
|
boolean |
isExtracting()
Check if extractor is currently working on extraction.
|
void |
prepare(FeatureProvider provider)
Prepare the feature.
|
void |
recycle()
Recycle feature, to make it ready for reuse.
|
void |
setCapacity(int capacity)
Set the maximum extractible unit number.
|
void |
setChecker(ExtractorChecker checker)
Set the extractor checker.
|
void |
setDropOffPerSecond(double speed)
Set the drop off unit per second.
|
void |
setExtractionPerSecond(double speed)
Set the extraction unit per second.
|
void |
setResource(Enum<?> type,
int tx,
int ty,
int tw,
int th)
Set the resources location in tile.
|
void |
setResource(Extractable extractable)
Set the resources location.
|
void |
startExtraction()
Start extraction.
|
void |
stopExtraction()
Stop any action related to extraction.
|
void |
update(double extrp) |
getFeature, getFeatures, getFeaturesType, hasFeature
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFeature, getFeatures, getFeaturesType, hasFeature
public ExtractorModel(Services services)
services
- The services reference.protected void actionGoingToResources()
protected void actionExtracting(double extrp)
extrp
- extrapolation value.protected void actionGoingToWarehouse()
protected void actionDropingOff(double extrp)
extrp
- extrapolation value.public void prepare(FeatureProvider provider)
Feature
Featurable.addFeature(Feature)
or
Featurable.addFeatureAndGet(Feature)
.prepare
in interface Feature
prepare
in class FeatureModel
provider
- The owner reference.public void checkListener(Object listener)
FeatureModel
Feature
provide listeners, this will
allow to add them automatically.
Does nothing by default.
checkListener
in interface Feature
checkListener
in class FeatureModel
listener
- The listener to check.public void addListener(ExtractorListener listener)
Extractor
addListener
in interface Extractor
listener
- The extractor listener to add.public void setChecker(ExtractorChecker checker)
Extractor
setChecker
in interface Extractor
checker
- The extractor checker reference.public void startExtraction()
Extractor
startExtraction
in interface Extractor
public void stopExtraction()
Extractor
stopExtraction
in interface Extractor
public boolean isExtracting()
Extractor
isExtracting
in interface Extractor
true
if extracting, false
else.public void setResource(Extractable extractable)
Extractor
setResource
in interface Extractor
extractable
- The extractable resource.public void setResource(Enum<?> type, int tx, int ty, int tw, int th)
Extractor
setResource
in interface Extractor
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 void setExtractionPerSecond(double speed)
Extractor
setExtractionPerSecond
in interface Extractor
speed
- The extraction unit per second.public void setDropOffPerSecond(double speed)
Extractor
setDropOffPerSecond
in interface Extractor
speed
- The drop off unit per second.public void setCapacity(int capacity)
Extractor
setCapacity
in interface Extractor
capacity
- The extraction capacity.public int getExtractionCapacity()
Extractor
getExtractionCapacity
in interface Extractor
public double getExtractionPerSecond()
Extractor
getExtractionPerSecond
in interface Extractor
public double getDropOffPerSecond()
Extractor
getDropOffPerSecond
in interface Extractor
public Tiled getResourceLocation()
Extractor
getResourceLocation
in interface Extractor
public Enum<?> getResourceType()
Extractor
getResourceType
in interface Extractor
public final void recycle()
Recyclable
recycle
in interface Recyclable
Copyright © 2017 Byron 3D Games Studio. All rights reserved.