public class ExtractorModel extends TraitModel implements Extractor
Constructor and Description |
---|
ExtractorModel()
Create a layerable 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.
|
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(ObjectGame owner,
Services services)
Prepare the trait.
|
void |
setCapacity(int capacity)
Set the maximum extractible unit number.
|
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) |
getOwner
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(ObjectGame owner, Services services)
Trait
prepare
in interface Trait
prepare
in class TraitModel
owner
- The owner reference.services
- The services reference.public void addListener(ExtractorListener listener)
Extractor
addListener
in interface Extractor
listener
- The extractor listener to add.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
Copyright © 2016 Byron 3D Games Studio. All rights reserved.