-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFarmBuilder.java
49 lines (34 loc) · 1.38 KB
/
FarmBuilder.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
49
package model.farm.builder;
import model.InGameTime;
import model.farm.*;
import model.farm.building.BuildingSet;
import model.farm.data.Livestock;
import model.farm.entity.Entity;
import model.farm.data.item.Crop;
import model.farm.data.Weather;
import java.util.List;
public abstract class FarmBuilder {
public Farm buildFarm() {
Farm farm = new Farm(this.getWidth(), this.getHeight(), this.getBuildings());
farm.setFarmer(this.getFarmer());
farm.setTime(this.getTime());
farm.setWallet(this.getWallet());
farm.setInventory(this.getInventory());
List<Crop> cropTypes = this.getCropTypes();
farm.addCropTypes(cropTypes);
farm.addLivestockTypes(this.getLivestockTypes(cropTypes));
farm.addWeatherTypes(this.getWeatherStates());
farm.setCurrentWeather(farm.getWeatherTypes().get(0));
return farm;
}
protected abstract int getWidth();
protected abstract int getHeight();
protected abstract BuildingSet getBuildings();
protected abstract Entity getFarmer();
protected abstract InGameTime getTime();
protected abstract Wallet getWallet();
protected abstract Inventory getInventory();
protected abstract List<Crop> getCropTypes();
protected abstract List<Livestock> getLivestockTypes(List<Crop> cropTypes);
protected abstract List<Weather> getWeatherStates();
}