|
|
|
|
|
|
|
|
private FlaechePflanzen flpfl; |
|
|
private FlaechePflanzen flpfl; |
|
|
|
|
|
|
|
|
private ArrayList<Pflanze> pflanzen; |
|
|
private ArrayList<Pflanze> pflanzen; |
|
|
|
|
|
|
|
|
Pflanze1 pfl; |
|
|
|
|
|
Pflanze1 pfl2; |
|
|
|
|
|
|
|
|
private ArrayList<Beet> beete; |
|
|
|
|
|
Pflanze1 pfl; |
|
|
|
|
|
Pflanze1 pfl2; |
|
|
int height; |
|
|
int height; |
|
|
int width; |
|
|
int width; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Gaertner(Fenster fenster, FlaecheBeet flbeet, FlaecheWeg flweg,FlaechePflanzen flpfl) |
|
|
public Gaertner(Fenster fenster, FlaecheBeet flbeet, FlaecheWeg flweg,FlaechePflanzen flpfl) |
|
|
{ |
|
|
{ |
|
|
meinGarten = new Garten(flbeet,flweg,flpfl); |
|
|
meinGarten = new Garten(flbeet,flweg,flpfl); |
|
|
this.flbeet = flbeet; |
|
|
|
|
|
this.fenster = fenster; |
|
|
|
|
|
this.flweg = flweg; |
|
|
|
|
|
|
|
|
this.fenster = fenster; //Zur späteren Steuerung Pop up usw. |
|
|
this.flpfl = flpfl; |
|
|
this.flpfl = flpfl; |
|
|
pflanzen = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pflanzen = new ArrayList<>(); |
|
|
|
|
|
beete = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
//Initialisierung der Wege/Beete |
|
|
height = fenster.getHeight(); |
|
|
height = fenster.getHeight(); |
|
|
width = fenster.getWidth(); |
|
|
width = fenster.getWidth(); |
|
|
|
|
|
|
|
|
randomwertex = new int[4]; |
|
|
randomwertex = new int[4]; |
|
|
randomwertey = new int[4]; |
|
|
randomwertey = new int[4]; |
|
|
randomwertex[0] = 10; |
|
|
randomwertex[0] = 10; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
meinGarten.zeichneWeg(); |
|
|
meinGarten.zeichneWeg(); |
|
|
meinGarten.zeichneBeete(); |
|
|
meinGarten.zeichneBeete(); |
|
|
|
|
|
beete = meinGarten.getBeete(); |
|
|
|
|
|
|
|
|
for (int i = 0; i<5; i++) |
|
|
|
|
|
|
|
|
for(Beet b : beete) |
|
|
{ |
|
|
{ |
|
|
pfl = new Pflanze1(100+(i*50),100+(i*50),3); |
|
|
|
|
|
meinGarten.hinzufuegenPflanze(pfl); |
|
|
|
|
|
|
|
|
Boolean bepflanzung = true; |
|
|
|
|
|
Boolean versetzt = true; |
|
|
|
|
|
int[] temp = b.getKoordinaten(); |
|
|
|
|
|
|
|
|
|
|
|
int tempx = temp[0]+20; |
|
|
|
|
|
int tempy = temp[1]+40; |
|
|
|
|
|
int tempxrand = temp [2]; |
|
|
|
|
|
int tempyrand = temp [3]; |
|
|
|
|
|
do |
|
|
|
|
|
{ |
|
|
|
|
|
System.out.println("Test"); |
|
|
|
|
|
pfl = new Pflanze1(tempx,tempy,3); |
|
|
|
|
|
meinGarten.hinzufuegenPflanze(pfl); |
|
|
|
|
|
tempx = tempx +50; |
|
|
|
|
|
if(tempx > tempxrand -10) |
|
|
|
|
|
{ |
|
|
|
|
|
if(versetzt) |
|
|
|
|
|
{ |
|
|
|
|
|
tempx = temp[0]+40; |
|
|
|
|
|
versetzt = false; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
tempx = temp[0]+20; |
|
|
|
|
|
versetzt = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
tempy = tempy+60; |
|
|
|
|
|
} |
|
|
|
|
|
if(tempy > tempyrand -10) |
|
|
|
|
|
{ |
|
|
|
|
|
bepflanzung = false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
while (bepflanzung); |
|
|
|
|
|
break; //Da bei gesamten zu viel Rechenaufwand :( |
|
|
} |
|
|
} |
|
|
meinGarten.zeichnePflanzen(); |
|
|
meinGarten.zeichnePflanzen(); |
|
|
} |
|
|
} |