public class ProducerModel extends TraitModel implements Producer
The Services
must provide the following services:
The ObjectGame
must be a ProducerChecker
.
If the ObjectGame
is a ProducerListener
, it will automatically addListener(ProducerListener)
on it.
Constructor and Description |
---|
ProducerModel()
Create a producer model.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ProducerListener listener)
Add a producer listener.
|
void |
addToProductionQueue(Producible producible)
Add an element to the production queue.
|
Media |
getProducingElement()
Get media of current producing element.
|
double |
getProgress()
Get production progress.
|
int |
getProgressPercent()
Get production progress percent.
|
int |
getQueueLength()
Get size of production queue.
|
boolean |
isProducing()
Return true if currently producing.
|
Iterator<Producible> |
iterator()
Get production iterator.
|
void |
prepare(ObjectGame owner,
Services services)
Prepare the trait.
|
void |
setStepsPerSecond(double stepsPerSecond)
Set the production steps number per second.
|
void |
skipProduction()
Skip current production.
|
void |
stopProduction()
Stop any production.
|
void |
update(double extrp) |
getOwner
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(ProducerListener listener)
Producer
addListener
in interface Producer
listener
- The producer listener to add.public void addToProductionQueue(Producible producible)
Producer
addToProductionQueue
in interface Producer
producible
- The element to produce.public void skipProduction()
Producer
skipProduction
in interface Producer
public void stopProduction()
Producer
stopProduction
in interface Producer
public void setStepsPerSecond(double stepsPerSecond)
Producer
setStepsPerSecond
in interface Producer
stepsPerSecond
- The production steps number per second.public double getProgress()
Producer
getProgress
in interface Producer
public int getProgressPercent()
Producer
getProgressPercent
in interface Producer
public Media getProducingElement()
Producer
getProducingElement
in interface Producer
public Iterator<Producible> iterator()
Producer
public int getQueueLength()
Producer
getQueueLength
in interface Producer
public boolean isProducing()
Producer
isProducing
in interface Producer
true
if producing, false
else.Copyright © 2016 Byron 3D Games Studio. All rights reserved.