package map;
import graphics.DrawBank;
import graphics.DrawBunny;
import graphics.DrawEntryPoint;
import graphics.DrawHidingPlace;
import graphics.DrawLampCross;
import graphics.DrawOrdinaryCar;
import graphics.DrawPoliceCar;
import graphics.DrawQuitPoint;
import graphics.DrawRobberyCar;
import graphics.DrawRoute;
import graphics.DrawStopCross;
import graphics.GraphicsBank;
import graphics.GraphicsBunny;
import graphics.GraphicsEntryPoint;
import graphics.GraphicsHidingPlace;
import graphics.GraphicsLampCross;
import graphics.GraphicsOrdinaryCar;
import graphics.GraphicsPoliceCar;
import graphics.GraphicsQuitPoint;
import graphics.GraphicsRobberyCar;
import graphics.GraphicsRoute;
import graphics.GraphicsStopCross;
import graphics.MainGraphics;
import route.Route;
import vehicles.OrdinaryCar;
import vehicles.PoliceCar;
import vehicles.RobberyCar;
import bunny.Bunny;
import controller.Controller;
import cross.Bank;
import cross.EntryPoint;
import cross.HidingPlace;
import cross.LampCross;
import cross.QuitPoint;
import cross.StopCross;
public class Map1 extends Map {
private Bunny bunny = null;
/**
* Konstruktor feluldefinialasa, itt hozzuk letre az egyes objektumokat,
* illetve meghivjuk a ConnectRoutesAndCrosses
*/
public Map1() {
charachterMap = "[E]---m--->[S]<---s---[L]<---|\r\n"
+ " \\ |\\ | |\r\n"
+ " \\ | \\ fel |\r\n"
+ " \\__>___ | \\_s>___ | |\r\n"
+ " \\le \\| |\r\n"
+ "[Q]<-------[B]---m--->[H] |\r\n"
+ " | |\r\n"
+ " ------------------\r\n" + " \r\n"
+ "m-main; s-secondary\r\n" + "E-entry; Q-quit;\r\n"
+ "S-stop; L-lamp; B-bank; H-hiding\r\n"
+ "le - lefele mutato ut\r\n" + "fel - felfele mutato ut\r\n";
// graphics osztaly letrehozasa
gr = MainGraphics.get();
// ENTRY POINTS
EntryPoint ep1 = new EntryPoint();
entrypoints.add(ep1);
// QUIT POINTS
QuitPoint qp1 = new QuitPoint();
qp1.setEntryPoint(ep1);
quitpoints.add(qp1);
// STOP CROSSES
StopCross sc1 = new StopCross();
stopcross.add(sc1);
// LAMP CROSSES
LampCross lc1 = new LampCross();
lampcross.add(lc1);
// HIDING PLACE
hidingplace = new HidingPlace();
// BANK
bank = new Bank();
// ROUTES
Route r0 = new Route(this, bank, quitpoints.get(0), 2000 * 4);
Route r1 = new Route(this, entrypoints.get(0), bank, 1600 * 4);
Route r2 = new Route(this, entrypoints.get(0), stopcross.get(0),
1800 * 4);
Route r3 = new Route(this, bank, lampcross.get(0), 1800 * 4);
Route r4 = new Route(this, bank, hidingplace, 1600 * 4);
Route r5 = new Route(this, stopcross.get(0), hidingplace, 1900 * 4);
Route r6 = new Route(this, hidingplace, lampcross.get(0), 1800 * 4);
Route r7 = new Route(this, lampcross.get(0), stopcross.get(0), 1200 * 4);
Route r8 = new Route(this, stopcross.get(0), bank, 2000 * 4);
routes.add(r0);
routes.add(r1);
routes.add(r2);
routes.add(r3);
routes.add(r4);
routes.add(r5);
routes.add(r6);
routes.add(r7);
routes.add(r8);
//TODO
bunny = Bunny.get(routes);
DrawRoute rd = new DrawRoute();
// r0-hoz grafikus objektumok letrehozasa
GraphicsRoute rg0 = new GraphicsRoute();
gr.addGraphicsObject(rg0, r0);
rg0.setDraw(rd);
rg0.setRoute(r0);
// r1-hez grafikus objektumok letrehozasa
GraphicsRoute rg1 = new GraphicsRoute();
gr.addGraphicsObject(rg1, r1);
rg1.setDraw(rd);
rg1.setRoute(r1);
// r2-hoz grafikus objektumok letrehozasa
GraphicsRoute rg2 = new GraphicsRoute();
gr.addGraphicsObject(rg2, r2);
rg2.setDraw(rd);
rg2.setRoute(r2);
// r3-hoz grafikus objektumok letrehozasa
GraphicsRoute rg3 = new GraphicsRoute();
gr.addGraphicsObject(rg3, r3);
rg3.setDraw(rd);
rg3.setRoute(r3);
// r4-hez grafikus objektumok letrehozasa
GraphicsRoute rg4 = new GraphicsRoute();
gr.addGraphicsObject(rg4, r4);
rg4.setDraw(rd);
rg4.setRoute(r4);
// r5-hoz grafikus objektumok letrehozasa
GraphicsRoute rg5 = new GraphicsRoute();
gr.addGraphicsObject(rg5, r5);
rg5.setDraw(rd);
rg5.setRoute(r5);
// r6-hoz grafikus objektumok letrehozasa
GraphicsRoute rg6 = new GraphicsRoute();
gr.addGraphicsObject(rg6, r6);
rg6.setDraw(rd);
rg6.setRoute(r6);
// r7-hoz grafikus objektumok letrehozasa
GraphicsRoute rg7 = new GraphicsRoute();
gr.addGraphicsObject(rg7, r7);
rg7.setDraw(rd);
rg7.setRoute(r7);
// r8-hoz grafikus objektumok letrehozasa
GraphicsRoute rg8 = new GraphicsRoute();
gr.addGraphicsObject(rg8, r8);
rg8.setDraw(rd);
rg8.setRoute(r8);
// csompontok grafikus osztalyainak letrehozasa
// 1. kell egy GraphicsXXX osztaly
// 2. kell egy Draw osztaly
// 3. ezeknek megadjuk az adott parametereit
GraphicsQuitPoint qpg1 = new GraphicsQuitPoint();
qpg1.setPosition(0, 375);
gr.addGraphicsObject(qpg1, qp1);
DrawQuitPoint qpd1 = new DrawQuitPoint();
qpg1.setDraw(qpd1);
qpg1.setCross(qp1);
// hozzaadjuk az entrypointot a grahpics-hoz
GraphicsEntryPoint epg1 = new GraphicsEntryPoint();
epg1.setPosition(0, 75);
gr.addGraphicsObject(epg1, ep1);
DrawEntryPoint epd1 = new DrawEntryPoint();
epg1.setDraw(epd1);
epg1.setCross(ep1);
// stopcross grafikus osztalyainak letrehozasa
GraphicsStopCross scg1 = new GraphicsStopCross();
scg1.setPosition(300, 75);
gr.addGraphicsObject(scg1, sc1);
DrawStopCross scd1 = new DrawStopCross();
scg1.setDraw(scd1);
scg1.setCross(sc1);
// lampcross grafikus osztalyainak letrehozasa
GraphicsLampCross lcg1 = new GraphicsLampCross();
lcg1.setPosition(600, 75);
gr.addGraphicsObject(lcg1, lc1);
DrawLampCross lcd1 = new DrawLampCross();
lcg1.setDraw(lcd1);
lcg1.setCross(lc1);
// hidingplace grafikus osztalyainak letrehozasa
GraphicsHidingPlace hg1 = new GraphicsHidingPlace();
hg1.setPosition(600, 375);
gr.addGraphicsObject(hg1, hidingplace);
DrawHidingPlace hd1 = new DrawHidingPlace();
hg1.setDraw(hd1);
hg1.setCross(hidingplace);
// bank grafikus osztalyainak letrehozasa
GraphicsBank bg1 = new GraphicsBank();
bg1.setPosition(300, 375);
gr.addGraphicsObject(bg1, bank);
DrawBank bd1 = new DrawBank();
bg1.setDraw(bd1);
bg1.setCross(bank);
// utak es keresztezodesek osszekapcsolasa, illetve autok utakra
// pakolasa
connectRouteAndCrosses();
}
/**
* Osszekoti az utakat a keresztezodesekkel
*/
@Override
protected void connectRouteAndCrosses() {
try{
// utak bekotese a keresztezodesekbe
// 0
bank.addOutRoutes(routes.get(0));
quitpoints.get(0).addInRoutes(routes.get(0));
// 1
entrypoints.get(0).addOutRoutes(routes.get(1));
bank.setPrimaryRoute(routes.get(1));
// 2
entrypoints.get(0).addOutRoutes(routes.get(2));
stopcross.get(0).setPrimaryRoute(routes.get(2));
// 3
bank.addOutRoutes(routes.get(3));
lampcross.get(0).addInRoutes(routes.get(3));
// 4
bank.addOutRoutes(routes.get(4));
hidingplace.setPrimaryRoute(routes.get(4));
// 5
stopcross.get(0).addOutRoutes(routes.get(5));
hidingplace.setSecondaryRoute(routes.get(5));
// 6
hidingplace.addOutRoutes(routes.get(6));
lampcross.get(0).addInRoutes(routes.get(6));
// 7
lampcross.get(0).addOutRoutes(routes.get(7));
stopcross.get(0).setSecondaryRoute(routes.get(7));
// 8
stopcross.get(0).addOutRoutes(routes.get(8));
bank.setSecondaryRoute(routes.get(8));
// AUTOK LETREHOZASA
robberyCar = new RobberyCar(bank, 100);
PoliceCar pc1 = new PoliceCar(70);
police_cars.add(pc1);
// police car grafikus hasznalata
DrawPoliceCar pold = new DrawPoliceCar();
GraphicsPoliceCar poldg = new GraphicsPoliceCar();
gr.addGraphicsObject(poldg, pc1);
poldg.setDraw(pold);
poldg.setPoliceCar(pc1);
// ordinarycar rajzolo
DrawOrdinaryCar ordcd = new DrawOrdinaryCar();
OrdinaryCar ordc1 = new OrdinaryCar(40);
ordinary_cars.add(ordc1);
// ordinaryCar grafikus hasznalata
GraphicsOrdinaryCar ordcg1 = new GraphicsOrdinaryCar();
gr.addGraphicsObject(ordcg1, ordc1);
ordcg1.setDraw(ordcd);
ordcg1.setOrdinaryCar(ordc1);
OrdinaryCar ordc2 = new OrdinaryCar(40);
ordinary_cars.add(ordc2);
// ordinaryCar grafikus hasznalata
GraphicsOrdinaryCar ordcg2 = new GraphicsOrdinaryCar();
gr.addGraphicsObject(ordcg2, ordc2);
ordcg2.setDraw(ordcd);
ordcg2.setOrdinaryCar(ordc2);
// RobberyCar grafikus hasznalata
DrawRobberyCar robd = new DrawRobberyCar();
GraphicsRobberyCar robg = new GraphicsRobberyCar();
gr.addGraphicsObject(robg, robberyCar);
robg.setDraw(robd);
robg.setRobberyCar(robberyCar);
Controller.get().addRobberyCar(robberyCar);
System.out.println("Bunny immune time es, hogy nem null: " + bunny.getImmuneTime());
// Bunny grafikus hasznalata
DrawBunny dbunny = new DrawBunny();
GraphicsBunny gb = new GraphicsBunny();
gr.addGraphicsObject(gb, Bunny.get());
gb.setDraw(dbunny);
// autokat rapakoljuk az utakra
routes.get(8).addVehicle(robberyCar, 3000);
routes.get(0).addVehicle(pc1, 1300);
routes.get(5).addVehicle(ordc1, 200);
routes.get(6).addVehicle(ordc2, 200);
} catch(Exception e){
e.printStackTrace();
}
}
}