Package vehicles

Examples of vehicles.Vehicle


   
    //itt csak azt kell vizsgalni, hogy a rablo utkozott-e masik autoval, mivel a tobbi auto
    //keruli az utkozest -> csak a rablo utkozhet
    if(vehicles.size() > 1){
      for(int i = 0; i < vehicles.size()-1; i++){
        Vehicle leader_car = vehicles.get(i);//az az auto ami elorebb halad
        Vehicle follower_car = vehicles.get(i+1);//az az auto, ami mogotte halad
       
        //lekerdezzuk a poziciokat
        int leader_pos = leader_car.getPosition();
        int follower_pos = follower_car.getPosition();
       
        //amolyan debug esetre
        if(leader_pos == follower_pos){
          if(leader_car.getCarType() == carType.Robbery || follower_car.getCarType() == carType.Robbery){
            Game.getInstance().finishGame();
          }
        }
       
        //lekerdezzuk a sebessegeket, amivel mennek
        int follower_currentSpd = follower_car.getCurrentSpeed();
        int leader_currentSpd = leader_car.getCurrentSpeed();
       
        //megvizsgaljuk, hogy a rablo utkozne-e az elotte haladoval[follower = robbery, leader=otherCar]
        if(follower_car.getCarType() == carType.Robbery){
          //ha a rablo olyan sebeseggel halad, hogy a kovetkezo pozicioja annyi lenne
          //mint az elotte halado autoe vagy attol nagyobb, akkor bizony utkozott es vege a jateknak
          if(follower_pos + follower_currentSpd >= leader_pos + leader_currentSpd)
            Game.getInstance().finishGame();
        }
       
        //megvizsgaljuk, hogyha a rablo forditva halad, akkor a "mogotte levobe" belemenne-e[follower = otherCar, leader = robbery, direction = false(hatrafele megy)]
        if(leader_car.getCarType() == carType.Robbery){
          //ha visszafele halad, akkor a sebessege negativ(tehat pl -90)
          if(leader_pos + leader_currentSpd <= follower_pos + follower_currentSpd){
            Game.getInstance().finishGame();
            break;
          }
        }
       
        if(follower_car.getCarType() == carType.Police && leader_car.getCarType() == carType.Robbery){
          if(follower_pos + follower_currentSpd >= leader_pos + leader_currentSpd && !((RobberyCar)leader_car).getImmune()){
            Game.getInstance().finishGame();
          }
        }
      }
View Full Code Here


  public Vehicle getAndRemoveLastCar() {
    //ha van valaki a keresztezodesnel
    if(vehiclesAtCross.size() > 0 ){
     
      //get and remove last car
      Vehicle removed_car = vehiclesAtCross.get(0);
      vehiclesAtCross.remove(0);
     
      //ha azon a valakin kivul meg mas is van a keresztezodesnel
      //akkor egyel elorebb tokjuk oket
      if(vehiclesAtCross.size() > 1){
View Full Code Here

    } else {
      System.out.println("Ez nem opcio...");
    }
    }
   
    Vehicle vehicle;
   
    if (isRobberyCar)
    {
      vehicle = new RobberyCar();
      inRoute.addVehicle(vehicle);
View Full Code Here

      } else {
        System.out.println("Ez nem opcio...");
      }
      }
     
      Vehicle vehicle;
     
      if (isRobberyCar)
      {
        vehicle = new RobberyCar();
        inRoute.addVehicle(vehicle);
View Full Code Here

TOP

Related Classes of vehicles.Vehicle

Copyright © 2018 www.massapicom. 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.