public class ProducerModel extends FeatureModel implements Producer, Recyclable
Constructor and Description |
---|
ProducerModel(Services services)
Create a producer model.
|
ProducerModel(Services services,
Setup setup)
Create a producer model.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ProducerListener listener)
Add a producer listener.
|
void |
addToProductionQueue(Featurable featurable)
Add an element to the production queue.
|
void |
checkListener(Object listener)
Check object interface listening and add them automatically.
|
List<ActionRef> |
getActions()
Get the allowed actions name.
|
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<Featurable> |
iterator()
Get production iterator.
|
void |
prepare(FeatureProvider provider)
Prepare the feature.
|
void |
recycle()
Recycle feature, to make it ready for reuse.
|
void |
setChecker(ProducerChecker checker)
Set the production checker.
|
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) |
getFeature, getFeatures, getFeaturesType, hasFeature
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFeature, getFeatures, getFeaturesType, hasFeature
public ProducerModel(Services services)
The Services
must provide the following services:
The Featurable
must be a ProducerChecker
.
If the Featurable
is a ProducerListener
, it will automatically
addListener(ProducerListener)
on it.
services
- The services reference.public ProducerModel(Services services, Setup setup)
The Services
must provide the following services:
The Featurable
must be a ProducerChecker
.
If the Featurable
is a ProducerListener
, it will automatically
addListener(ProducerListener)
on it.
services
- The services reference.setup
- The setup reference.public void prepare(FeatureProvider provider)
Feature
Featurable.addFeature(Feature)
or
Featurable.addFeatureAndGet(Feature)
.prepare
in interface Feature
prepare
in class FeatureModel
provider
- The owner reference.public void checkListener(Object listener)
FeatureModel
Feature
provide listeners, this will
allow to add them automatically.
Does nothing by default.
checkListener
in interface Feature
checkListener
in class FeatureModel
listener
- The listener to check.public void addListener(ProducerListener listener)
Producer
addListener
in interface Producer
listener
- The producer listener to add.public void setChecker(ProducerChecker checker)
Producer
setChecker
in interface Producer
checker
- The production checker reference.public void addToProductionQueue(Featurable featurable)
Producer
addToProductionQueue
in interface Producer
featurable
- 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<Featurable> iterator()
Producer
public List<ActionRef> getActions()
Actioner
getActions
in interface Actioner
public int getQueueLength()
Producer
getQueueLength
in interface Producer
public boolean isProducing()
Producer
isProducing
in interface Producer
true
if producing, false
else.public final void recycle()
Recyclable
recycle
in interface Recyclable
Copyright © 2017 Byron 3D Games Studio. All rights reserved.