Package map

Source Code of map.Map2

package map;

import route.Route;
import vehicles.OrdinaryCar;
import vehicles.PoliceCar;
import vehicles.RobberyCar;
import cross.Bank;
import cross.EntryPoint;
import cross.HidingPlace;
import cross.LampCross;
import cross.QuitPoint;
import cross.StopCross;

public class Map2 extends Map{
  //TODO: meg nincs implementalva! ez lesz a map ketto!
  /**
   * Konstruktor feluldefinialasa, itt hozzuk letre az egyes objektumokat, illetve meghivjuk a ConnectRoutesAndCrosses
   */
  public Map2(){
   
  charachterMap = "|----[E]---->[B]------->[Q]\r\n"
          + "|    /|\\    /|\r\n"
          + "|     | \\    |\r\n"
          + "m     m  \\   |\r\n"
          + "|     |   \\| |\r\n"
          + "|  |-[S]--->[L]\r\n"
          + "|  s        /| \r\n"
          + "|/ |/        | \r\n"
          + "[ H]---------- \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";
   
 
 
    //ENTRY POINTS
    EntryPoint ep1 = new EntryPoint();
    entrypoints.add(ep1);
 
    //QUIT POINTS
    QuitPoint qp1 = new QuitPoint();
    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, entrypoints.get(0),hidingplace, 1000);
    Route r1 = new Route(this, stopcross.get(0), hidingplace, 800);
    Route r2 = new Route(this, entrypoints.get(0), stopcross.get(0), 900);
    Route r3 = new Route(this, hidingplace, lampcross.get(0), 900);
    Route r4 = new Route(this, stopcross.get(0),lampcross.get(0), 800)
    Route r5 = new Route(this, entrypoints.get(0), lampcross.get(0), 600);
    Route r6 = new Route(this, lampcross.get(0), bank, 1000);
    Route r7 = new Route(this, bank,quitpoints.get(0), 1000);
    Route r8 = new Route(this, entrypoints.get(0),bank, 1000);
   
    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);
 
    connectRouteAndCrosses();
  }
 
  @Override
  protected void connectRouteAndCrosses() {
   
    //utak bekotese a keresztezodesekbe
    //0
    entrypoints.get(0).addOutRoutes(routes.get(0));
    //hidingplace.addInRoutes(routes.get(0));
    hidingplace.setPrimaryRoute(routes.get(0));
   
    //1
    stopcross.get(0).addOutRoutes(routes.get(1));
    //hidingplace.addInRoutes(routes.get(1));
    hidingplace.setSecondaryRoute(routes.get(1));
   
    //2
    entrypoints.get(0).addOutRoutes(routes.get(2));
    //stopcross.get(0).addInRoutes(routes.get(2));
    stopcross.get(0).setPrimaryRoute(routes.get(2));
   
    //3
    hidingplace.addOutRoutes(routes.get(3));
    lampcross.get(0).addInRoutes(routes.get(3));
   
    //4
    stopcross.get(0).addOutRoutes(routes.get(4));
    lampcross.get(0).addInRoutes(routes.get(4));
   
    //5
    entrypoints.get(0).addOutRoutes(routes.get(5));
    lampcross.get(0).addInRoutes(routes.get(5));
   
    //6
    lampcross.get(0).addOutRoutes(routes.get(6));
    bank.addInRoutes(routes.get(6));
   
    //7
    bank.addOutRoutes(routes.get(7));
    quitpoints.get(0).addInRoutes(routes.get(6));   

   
    //8
    entrypoints.get(0).addOutRoutes(routes.get(8));
    bank.addInRoutes(routes.get(8));
   
   
    //AUTOK LETREHOZASA
    robberyCar = new RobberyCar(bank, 100);
   
    PoliceCar pc1 = new PoliceCar(70);
    police_cars.add(pc1);
   
    OrdinaryCar ordc1 = new OrdinaryCar(40);
    ordinary_cars.add(ordc1);
   
    OrdinaryCar ordc2 = new OrdinaryCar(40);
    ordinary_cars.add(ordc2);
   
    //autokat rapakoljuk az utakra
    bank.addVehicleToCross(robberyCar);
   
    routes.get(0).addVehicle(pc1,300);
    routes.get(5).addVehicle(ordc1, 500);
    routes.get(5).addVehicle(ordc2, 200);
  }
}
TOP

Related Classes of map.Map2

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.