com.b3dgs.lionengine.game.strategy.ability
Class AbstractExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>

java.lang.Object
  extended by com.b3dgs.lionengine.game.strategy.ability.AbstractExtractAbility<TTile,TSkill,TAttr,TRsc>
Type Parameters:
TTile - tile type used.
TSkill - skill type used.
TAttr - attributes type used.
All Implemented Interfaces:
ExtractAbility<TTile,TSkill,TAttr,TRsc>

public abstract class AbstractExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
extends java.lang.Object
implements ExtractAbility<TTile,TSkill,TAttr,TRsc>

This is the main implementation of the extract ability. This object can be used by any kind of unit which will receive the ability of extraction.


Field Summary
protected  int rscX
          Ressources location in tile.
protected  int rscY
          Ressources location in tile.
protected  int whsX
          Warehouse location in tile.
protected  int whsY
          Warehouse location in tile.
 
Constructor Summary
AbstractExtractAbility(AbstractUnit<TTile,TSkill,TAttr> worker)
          Create a new extract ability.
 
Method Summary
abstract  boolean canCarry()
          Action called when entry is going to carry.
abstract  boolean canExtract()
          Action called when entry is going to extract.
 TRsc getRessourceType()
          Get ressource type.
 boolean hasRessources()
          Check if worker has a ressources location.
 boolean hasWarehouse()
          Check if worker has a warehouse location.
 boolean isExtracting()
          Check if worker is currently working on extraction.
abstract  void onCarried()
          Action called when entry carried ressources.
abstract  void onCarry()
          Action called when entry is carrying ressources.
abstract  void onDropOff()
          Action called when entry is back to the warehouse.
abstract  void onDroppedOff()
          Action called when entry has dropped ressources to warehouse.
abstract  void onExtract()
          Action called when entry is extracting ressources.
abstract  void onExtracted()
          Action called when extraction is done.
abstract  void onGotoRessource()
          Action called when entry is moving until ressources.
 void setDropOffTime(long time)
          Set time to drop off ressource inside the warehouse.
 void setExtractionTime(long time)
          Set time for extraction (in millisecond).
 void setRessourceLocation(int tx, int ty)
          Set ressource location (as a tile).
 void setRessourceType(TRsc type)
          Set ressource type to extract.
 void setWarehouse(int tx, int ty)
          Set storage point (where will be stored ressources).
 void startExtraction()
          Start extraction.
 void stopExtraction()
          Stop any action related to extration.
 void updateExtraction(float extrp)
          Update extraction (extract and go back).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rscX

protected int rscX
Ressources location in tile.


rscY

protected int rscY
Ressources location in tile.


whsX

protected int whsX
Warehouse location in tile.


whsY

protected int whsY
Warehouse location in tile.

Constructor Detail

AbstractExtractAbility

public AbstractExtractAbility(AbstractUnit<TTile,TSkill,TAttr> worker)
Create a new extract ability.

Parameters:
worker - concerned worker reference.
Method Detail

updateExtraction

public void updateExtraction(float extrp)
Description copied from interface: ExtractAbility
Update extraction (extract and go back).

Specified by:
updateExtraction in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Parameters:
extrp - extrapolation value.

setRessourceLocation

public void setRessourceLocation(int tx,
                                 int ty)
Description copied from interface: ExtractAbility
Set ressource location (as a tile).

Specified by:
setRessourceLocation in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Parameters:
tx - map tile x.
ty - map tile y.

setWarehouse

public void setWarehouse(int tx,
                         int ty)
Description copied from interface: ExtractAbility
Set storage point (where will be stored ressources).

Specified by:
setWarehouse in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Parameters:
tx - map tile x.
ty - map tile y.

hasRessources

public boolean hasRessources()
Description copied from interface: ExtractAbility
Check if worker has a ressources location.

Specified by:
hasRessources in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Returns:
true if has ressources location.

hasWarehouse

public boolean hasWarehouse()
Description copied from interface: ExtractAbility
Check if worker has a warehouse location.

Specified by:
hasWarehouse in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Returns:
true if has storage location.

setExtractionTime

public void setExtractionTime(long time)
Description copied from interface: ExtractAbility
Set time for extraction (in millisecond).

Specified by:
setExtractionTime in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Parameters:
time - extraction time in millisecond.

setDropOffTime

public void setDropOffTime(long time)
Description copied from interface: ExtractAbility
Set time to drop off ressource inside the warehouse.

Specified by:
setDropOffTime in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Parameters:
time - drop off time in millisecond.

startExtraction

public void startExtraction()
Description copied from interface: ExtractAbility
Start extraction.

Specified by:
startExtraction in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>

isExtracting

public boolean isExtracting()
Description copied from interface: ExtractAbility
Check if worker is currently working on extraction.

Specified by:
isExtracting in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Returns:
true if extracting.

stopExtraction

public void stopExtraction()
Description copied from interface: ExtractAbility
Stop any action related to extration.

Specified by:
stopExtraction in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>

setRessourceType

public void setRessourceType(TRsc type)
Description copied from interface: ExtractAbility
Set ressource type to extract.

Specified by:
setRessourceType in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Parameters:
type - ressource type.

getRessourceType

public TRsc getRessourceType()
Description copied from interface: ExtractAbility
Get ressource type.

Specified by:
getRessourceType in interface ExtractAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes,TRsc>
Returns:
ressource type.

canExtract

public abstract boolean canExtract()
Action called when entry is going to extract.

Returns:
extraction condition result.

canCarry

public abstract boolean canCarry()
Action called when entry is going to carry.

Returns:
carry condition result.

onGotoRessource

public abstract void onGotoRessource()
Action called when entry is moving until ressources.


onExtract

public abstract void onExtract()
Action called when entry is extracting ressources.


onExtracted

public abstract void onExtracted()
Action called when extraction is done.


onCarry

public abstract void onCarry()
Action called when entry is carrying ressources.


onCarried

public abstract void onCarried()
Action called when entry carried ressources.


onDropOff

public abstract void onDropOff()
Action called when entry is back to the warehouse.


onDroppedOff

public abstract void onDroppedOff()
Action called when entry has dropped ressources to warehouse.