com.b3dgs.lionengine.game.strategy.ability
Interface ProducerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>

Type Parameters:
TTile - tile type used.
TSkill - skill type used.
TAttr - attributes type used.
All Known Implementing Classes:
AbstractProducerAbility

public interface ProducerAbility<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>

This interface represents the ability of producing new entity. It includes production queue, and production time.


Method Summary
 void addToProductionQueue(java.lang.String name, int time)
          Add an element to the production queue.
 java.lang.String getProducingElement()
          Get name of current producing element.
 int getProductionProgress()
          Get production progress in percent.
 int getQueueLength()
          Get size of production queue.
 void setRallyLocation(int tx, int ty)
          Rally location in tile.
 void stopProduction()
          Stop any production.
 void updateProduction()
          Update production routine.
 

Method Detail

addToProductionQueue

void addToProductionQueue(java.lang.String name,
                          int time)
Add an element to the production queue. It works as a FIFO (First In, First Out). Production will be stopped when the list is empty. In this case, getProductionProgress() will return -1. Production list stores only entity name. You have to return the corresponding instance by overriding this function: getUnitToProduce(String name).

Parameters:
name - entry name to produce.
time - production time.

updateProduction

void updateProduction()
Update production routine.


stopProduction

void stopProduction()
Stop any production.


setRallyLocation

void setRallyLocation(int tx,
                      int ty)
Rally location in tile.

Parameters:
tx - horizontal tile index.
ty - vertical tile index.

getProductionProgress

int getProductionProgress()
Get production progress in percent. If it returns -1, it means that there are not any active production.

Returns:
percent of progress.

getProducingElement

java.lang.String getProducingElement()
Get name of current producing element.

Returns:
name of current producing element.

getQueueLength

int getQueueLength()
Get size of production queue.

Returns:
number of remaining products.