Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. public void checkEntrances(){
  2.  
  3. for(int i = 0; i<this.carsOnStreet.size(); i++){
  4. Car currentCar = carsOnStreet.get(i);
  5. //Only looks at cars, which are not moving (Car is only not moving if waiting at Entrance)
  6. if(!currentCar.isMoving()){
  7. if(currentCar.getPosY() == Vars.ENTRACE_CARWASH_Y){
  8. if(Tankstelle.einfahrtCarWash.dynArray.size() < Vars.ENTRANCE_CARWASH_QUEUE_MAXLENGTH){
  9. System.out.println("Car");
  10. Tankstelle.einfahrtCarWash.dynArray.add(currentCar);
  11. carsOnStreet.remove(i);
  12. i--;
  13. }
  14. else{
  15. carMovement carMovement = new carMovement(currentCar, Vars.CARMOVEMENT_UP, Vars.STREET_WELCOME_END_POS_Y);
  16. Tankstelle.movementManager.addCarMovement(carMovement);
  17. }
  18. } else if(currentCar.getPosY() == Vars.ENTRANCE_FUELSTATION_Y){
  19. if(Tankstelle.einfahrtFuel.dynArray.size() < Vars.ENTRANCE_FUELSTATION_QUEUE_MAXLENGTH){
  20. Tankstelle.einfahrtFuel.dynArray.add(currentCar);
  21. System.out.println("Fuel");
  22. carsOnStreet.remove(i);
  23. i--;
  24. }else{
  25. carMovement carMovement = new carMovement(currentCar, Vars.CARMOVEMENT_UP, Vars.STREET_WELCOME_END_POS_Y);
  26. Tankstelle.movementManager.addCarMovement(carMovement);
  27. }
  28. }
  29. else if(currentCar.getPosY() == Vars.STREET_WELCOME_END_POS_Y){
  30. carsOnStreet.remove(i);
  31. i--;
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement