public override Compiler.Variable runFunction(Compiler.Scope currentScope, Compiler.Variable[] inputParas, int lineNumber) { GameObject currentCar = CarQueue.GetFirstCar(); if (currentCar == null) { PMWrapper.RaiseError(lineNumber, "Hittade inget tåg att tömma. "); } UnloadableItem[] itemsToUnload = currentCar.GetComponentsInChildren <UnloadableItem>(); if (itemsToUnload.Length == 0) { PMWrapper.RaiseError(lineNumber, "Kan inte tömma ett tomt tåg. Kom ihåg att köra fram nästa tåg innan du tömmer igen."); } foreach (UnloadableItem item in itemsToUnload) { if (item != null) { item.IsUnloading = true; } } GameObject.FindGameObjectWithTag("SceneController").GetComponent <SceneController1_3>().carsUnloaded += 1; return(new Compiler.Variable()); }
public override Variable runFunction(Scope currentScope, Variable[] inputParas, int lineNumber) { GameObject car = CarQueue.GetFirstCar(); if (car == null) { PMWrapper.RaiseError(lineNumber, "Kan inte hitta något att scanna."); } Scanner scanner = Scanner.Instance; scanner.Scan(car); int lampCount = 0; foreach (Transform child in car.transform) { if (child.CompareTag("Lamp")) { lampCount++; } } scanner.SetDisplayText(lampCount); return(new Variable("lampCount", lampCount)); }
public override Compiler.Variable runFunction(Compiler.Scope currentScope, Compiler.Variable[] inputParas, int lineNumber) { CarQueue.DriveQueueForward(); CarQueue.DriveFirstCarShort(); return(new Compiler.Variable()); }
public override Variable runFunction(Scope currentScope, Variable[] inputParas, int lineNumber) { int batteryLevel = CarQueue.GetFirstCar().GetComponent <CarInfo>().BatteryLevel; ChargeStation.Instance.CheckBattery(batteryLevel); return(new Variable("BatteryLevel", batteryLevel)); }
public override Variable runFunction(Scope currentScope, Variable[] inputParas, int lineNumber) { SortedQueue.ForwardQueue.Add(CarQueue.GetFirstCar()); CarQueue.DriveQueueForward(); CarQueue.DriveFirstCarStraight(); return(new Variable()); }
private async Task createDetailCarQ(int Did, int time, string type, IList<CarsPart> managecarNEW) { foreach (var item in managecarNEW) { int index = managecarNEW.IndexOf(item); List<DetailOT> empList; try { empList = item.DetailOT.Where(e => getIDPart(e.Point_PointID) == item.PartID).ToList(); } catch (Exception) { empList = new List<DetailOT>(); } foreach (var j in item.ListCars) { int Emp = 0; int index2 = managecarNEW[index].ListCars.IndexOf(j); for (int i = 0; i < managecarNEW[index].ListCars[index2].countCar; i++) { CarQueue createCarQueue = new CarQueue(); createCarQueue.CarNumber = i+1; createCarQueue.Type = type; createCarQueue.CarQueue_OTID = Did; createCarQueue.Time = new DateTime(OT.date.Year, OT.date.Month, OT.date.Day, time, 0, 0); createCarQueue.CarQueue_PartID = item.PartID; createCarQueue.CarQueue_CarTypeID = j.CarTypeID; _context.CarQueue.Add(createCarQueue); await _context.SaveChangesAsync(); for (int q = 1; q <= j.seed; q++) { if (Emp == empList.Count) { break; } DetailCarQueue createDetailCarQueue = new DetailCarQueue(); createDetailCarQueue.DetailCarQueue_EmployeeID = empList[Emp].Employee_EmpID; createDetailCarQueue.DetailCarQueue_CarQueueID = createCarQueue.CarQueueID; _context.DetailCarQueue.Add(createDetailCarQueue); Emp = Emp + 1; await _context.SaveChangesAsync(); } } } } }
public override Variable runFunction(Scope currentScope, Variable[] inputParas, int lineNumber) { GameObject firstCar = CarQueue.GetFirstCar(); Scanner scanner = Scanner.Instance; scanner.Scan(firstCar); Dictionary <string, int> typesFound = new Dictionary <string, int>(); string type = ""; foreach (Transform t in firstCar.transform) { if (t.CompareTag("Palm")) { type = "palmer"; } else if (t.CompareTag("Table")) { type = "bord"; } else if (t.CompareTag("Chair")) { type = "stolar"; } else if (t.CompareTag("Lamp")) { type = "lampor"; } else if (t.CompareTag("Tree")) { type = "granar"; } if (type.Length > 0) { typesFound[type] = 1; } } if (typesFound.Count > 1) { throw new Exception("There are more than one type of items in current car. Can not unambiguously decide item type."); } scanner.SetDisplayText(type); return(new Variable("type", type)); }
protected override void CheckForCars() { if (Log) { Debug.Log("Override"); } if (CarQueue.Count > 0) { Car car = CarQueue.Dequeue(); Lane newLane = Random.Range(0, 10) >= 5 ? MainRoad.LaneA : MainRoad.LaneB; car.MoveToLaneOffset(newLane, this, IntersectionOffset); } }
static void Main(string[] args) { CarQueue queue1 = new CarQueue("Queue 1"); CarQueue queue2 = new CarQueue("Queue 2"); CarQueue queue3 = new CarQueue("Queue 3"); Producer producer = new Producer(queue1, queue2, queue3); Paywall stander1 = new Paywall(queue1); Paywall stander2 = new Paywall(queue2); Paywall stander3 = new Paywall(queue3); var threads = new List <Thread>() { new Thread(producer.Run), new Thread(stander1.Run), new Thread(stander2.Run), new Thread(stander3.Run) }; Console.ReadKey(); }
public override Variable runFunction(Scope currentScope, Variable[] inputParas, int lineNumber) { GameObject car = CarQueue.GetFirstCar(); Scanner scanner = Scanner.Instance; scanner.Scan(car); int tableCount = 0; foreach (Transform child in car.transform) { if (child.CompareTag("Table")) { tableCount++; } } scanner.SetDisplayText(tableCount); return(new Variable("tablecount", tableCount)); }
// Use this for initialization void Start() { if (topQueueSize == 0) { topQueue = null; } else { topQueue = new CarQueue(topQueueSize); } if (bottomQueueSize == 0) { bottomQueue = null; } else { bottomQueue = new CarQueue(bottomQueueSize); } if (leftQueueSize == 0) { leftQueue = null; } else { leftQueue = new CarQueue(leftQueueSize); } if (rightQueueSize == 0) { rightQueue = null; } else { rightQueue = new CarQueue(rightQueueSize); } }
private void SetCarCharged() { var carInfo = CarQueue.GetFirstCar().GetComponent <CarInfo>(); int chargeBound = LevelController.CaseData.chargeBound; if (carInfo.HasBeenCharged) { return; } if (carInfo.StartBatteryLevel < chargeBound) { SceneController2_1.CorrectlyCharged++; } else { if (carInfo.StartBatteryLevel != 100) { SceneController2_1.FalselyCharged++; } } carInfo.HasBeenCharged = true; }
public void ChargeBattery() { currentCarInfo = CarQueue.GetFirstCar().GetComponent <CarInfo>(); isRasingWalls = true; }
private List <timelist> massCarQ() { List <timelist> add = new List <timelist>(); for (int a = 0; a < 3; a++) { int time; if (a == 0) { time = 8; } else if (a == 1) { time = 17; } else { time = 20; } var listAdd = new timelist(); listAdd.time = time; var addcarq = new List <carQ>(); foreach (var item in Part) { if (!item.Name.Equals("No")) { var list = CarQueue.Where(l => l.CarQueue_PartID == item.PartID && l.Time.Hour == time).ToList(); if (list.Count != 0) { carQ AddCarQ = new carQ(); AddCarQ.part = item; var addList = new List <carListNumber>(); foreach (var i in CarType) { var CarTypePart = list.Where(c => c.CarQueue_CarTypeID == i.CarTypeID).ToList(); if (CarTypePart.Count != 0 && i.Seat != 0) { carListNumber carListNumber = new carListNumber(); carListNumber.CarType = i; carListNumber.maxCar = CarTypePart.Max(z => z.CarNumber); addList.Add(carListNumber); } } AddCarQ.carListNumber = addList; addcarq.Add(AddCarQ); } } } listAdd.carQ = addcarq; if (listAdd.carQ.Count != 0) { add.Add(listAdd); } } return(add); }
private void RemoveOldAssets() { CarQueue.RemoveAllCars(); Destroy(queue); }