-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProducing.java
48 lines (40 loc) · 1.38 KB
/
Producing.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package model.farm.building.stockyard.state;
import gui.Color;
import model.InGameTime;
import model.farm.building.stockyard.Stockyard;
public class Producing implements StockyardState {
private final Stockyard stockyard;
private InGameTime timeRemaining;
private double collectAmount; // double so that small but in great quantity changes can have an effect
public Producing(Stockyard stockyard) {
this.stockyard = stockyard;
this.collectAmount = this.stockyard.getBaseProducedAmount();
this.timeRemaining = stockyard.getLivestockType().getProducedItem().getProductionTime();
}
@Override
public InGameTime getRemainingTime() {
return this.timeRemaining;
}
@Override
public void setRemainingTime(InGameTime time) {
this.timeRemaining = time;
if (this.timeRemaining.getMinute() <= 0) {
this.stockyard.setState(new ReadyToCollect(this.stockyard, this.collectAmount));
}
}
@Override
public int getCollectAmount() {
return (int) this.collectAmount;
}
@Override
public void changeCollectAmount(double collectAmount) {
this.collectAmount += collectAmount;
if (this.collectAmount <= 0) {
this.stockyard.setState(new NotProducing());
}
}
@Override
public Color getAnimalColor() {
return new Color("#c96d82");
}
}