T
- The entity enum type used.C
- The cost type used.P
- The producible type used.E
- The entity type used.public class ProducerModel<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>,E extends EntityStrategy> extends AbilityModel<ProducerListener<T,C,P,E>,ProducerUsedServices<T,C,P,E>> implements ProducerServices<T,C,P>, ProducerListener<T,C,P,E>
Modifier and Type | Field and Description |
---|---|
protected HandlerEntityStrategy<?,?,E,?> |
handler
Handler reference.
|
listeners, user
Constructor and Description |
---|
ProducerModel(ProducerUsedServices<T,C,P,E> user,
HandlerEntityStrategy<?,?,E,?> handler,
int desiredFps)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
actionCheck()
Action called from update production in check state.
|
protected void |
actionProduced()
Action called from update production in produced state.
|
protected void |
actionProducing(double extrp)
Action called from update production in producing state.
|
protected void |
actionWillProduce()
Action called from update production in will produce state.
|
void |
addToProductionQueue(P producible)
Add an element to the production queue.
|
T |
getProducingElement()
Get name of current producing element.
|
Iterator<P> |
getProductionIterator()
Get production iterator.
|
double |
getProductionProgress()
Get production progress.
|
int |
getProductionProgressPercent()
Get production progress percent.
|
int |
getQueueLength()
Get size of production queue.
|
boolean |
isProducing()
Return true if currently producing.
|
void |
notifyCanNotProduce(P producible)
Notify listener that current element can not be produced.
|
void |
notifyProduced(P producible,
E entity)
Notify listener that this element has been produced.
|
void |
notifyProducing(P producible,
E entity)
Notify listener that this element is currently under production.
|
void |
notifyStartProduction(P producible,
E entity)
Notify listener that production is starting for this element.
|
void |
skipProduction()
Skip current production.
|
void |
stopProduction()
Stop any production.
|
void |
updateProduction(double extrp)
Update production routine.
|
addListener, removeListener
protected final HandlerEntityStrategy<?,?,E extends EntityStrategy,?> handler
public ProducerModel(ProducerUsedServices<T,C,P,E> user, HandlerEntityStrategy<?,?,E,?> handler, int desiredFps)
user
- The model user.handler
- The handler reference.desiredFps
- The the desired frame rate.protected void actionWillProduce()
protected void actionProducing(double extrp)
extrp
- The extrapolation value.protected void actionProduced()
protected void actionCheck()
public void addToProductionQueue(P producible)
ProducerServices
addToProductionQueue
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
producible
- The element to produce.public void updateProduction(double extrp)
ProducerServices
updateProduction
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
extrp
- The extrapolation value.public void skipProduction()
ProducerServices
skipProduction
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
public void stopProduction()
ProducerServices
stopProduction
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
public double getProductionProgress()
ProducerServices
getProductionProgress
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
public int getProductionProgressPercent()
ProducerServices
getProductionProgressPercent
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
public T getProducingElement()
ProducerServices
getProducingElement
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
public Iterator<P> getProductionIterator()
ProducerServices
getProductionIterator
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
public int getQueueLength()
ProducerServices
getQueueLength
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
public boolean isProducing()
ProducerServices
isProducing
in interface ProducerServices<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>>
true
if producing, false
else.public void notifyCanNotProduce(P producible)
ProducerListener
notifyCanNotProduce
in interface ProducerListener<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>,E extends EntityStrategy>
producible
- The element that would have been under production.public void notifyStartProduction(P producible, E entity)
ProducerListener
notifyStartProduction
in interface ProducerListener<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>,E extends EntityStrategy>
producible
- The element going to be producedentity
- The entity instance from element.public void notifyProducing(P producible, E entity)
ProducerListener
notifyProducing
in interface ProducerListener<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>,E extends EntityStrategy>
producible
- The element under production.entity
- The entity instance from element.public void notifyProduced(P producible, E entity)
ProducerListener
notifyProduced
in interface ProducerListener<T extends Enum<T>,C extends ProductionCostStrategy,P extends Producible<T,C>,E extends EntityStrategy>
producible
- The element produced.entity
- The entity instance from element.Copyright © 2014 Byron 3D Games Studio. All rights reserved.