public void SourceArrival(Load load, DematicFixPoint sourceFixPoint) { // Get the correct FixPoint for this destination List <FixPoint> fixpointDestinations = GetFixPointDestinations(); string destinationName = GetRandomDestination(fixpointDestinations); // Temporary : Get random one for now var fpName = fixpointDestinations.Find(x => x.ContainsDestination(destinationName) == true).Name; DematicFixPoint fp = (DematicFixPoint)tCar.FixPoints.Find(x => x.Name == fpName); TCarTask task = new TCarTask { Source = sourceFixPoint, Destination = fp, }; tCar.Tasks.Add(task); }
private void FixPointLoadWaitingStatus_OnLoadWaitingChanged(object sender, LoadWaitingChangedEventArgs e) { Load load = e._waitingLoad; if (load != null && load.Route != null && e._loadWaiting) { IRouteStatus conveyor = (IRouteStatus)e._waitingLoad.Route.Parent.Parent; if (ControlType == ControlTypes.Local) { // Select a destination at random (this will be replaced by controller code) string destinationName = GetRandomDestination(); // Temporary : Get random one for now DematicFixPoint destinationFP = (DematicFixPoint)FixPoints.Find(x => x.Name == destinationName); DematicFixPoint sourceFP = (DematicFixPoint)conveyor.EndFixPoint.Attached; if (sourceFP != null) { TCarTask task = new TCarTask { Source = sourceFP, Destination = destinationFP, }; Tasks.Add(task); } } else if (ControlType == ControlTypes.Project_Script) // TODO: Invent event to attach routing script to { SourceLoadArrived(load, (DematicFixPoint)conveyor.EndFixPoint.Attached); } else if (ControlType == ControlTypes.Controller) { if (Controller != null) { sourceArrival?.Invoke(load, (DematicFixPoint)conveyor.EndFixPoint.Attached); } } } }