private void RemoveAllDematicFixpoints() { var dematicFixPoints = FixPoints.FindAll(x => x is DematicFixPoint); foreach (var fp in dematicFixPoints) { fp.Dispose(); Remove(fp); } var labels = Parts.OfType <Text3D>(); foreach (var label in labels) { label.Dispose(); Remove(label); } }
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); } } } }