コード例 #1
0
 private void MoveLoadBackToConveyor()
 {
     currentLoad = GetCurrentLoad();
     stackedLoad = GetStackedLoad();
     if (stackedLoad != null)
     {
         var stackedLoads      = stackedLoad.Grouped.Items;
         var stackedLoadsCount = stackedLoads.Count;
         stackedLoad.UnGroup();
         // First move the stacked load itself
         stackedLoad.Switch(TransportSection.Route, stackedLoad.Distance - 0.001f, true);
         if (currentLoad != null)
         {
             currentLoad.Group(stackedLoad, new Vector3(0, TrayHeight + 0.005f, 0));
         }
         // Second move all the loads that were previously grouped to it
         for (int i = 0; i < stackedLoadsCount; i++)
         {
             stackedLoads[i].Switch(TransportSection.Route, true);
             if (currentLoad != null)
             {
                 currentLoad.Group(stackedLoads[i], new Vector3(0, (TrayHeight + 0.005f) * (i + 2), 0));
             }
             else
             {
                 stackedLoad.Group(stackedLoads[i], new Vector3(0, (TrayHeight + 0.005f) * (i + 1), 0));
             }
         }
     }
     ReleaseLoad();
 }
コード例 #2
0
 private void DestackLoads()
 {
     // Check whether the load entering is loaded and if so allow it to pass through
     currentLoad = GetCurrentLoad();
     currentLoad.UserDeletable = true;
     if (currentLoad.Status != TrayStatus.Loaded)
     {
         var currentStackedLoads = currentLoad.Grouped.Items;
         currentLoad.DetachStackedTrays();
         currentLoad.Status = TrayStatus.Empty;
         stackedLoad        = GetStackedLoad();
         if (stackedLoad == null)
         {
             // Take first from stack and add to stacker conveyor
             if (currentStackedLoads.Count > 0)
             {
                 currentStackedLoads[0].Switch(stackConveyor.TransportSection.Route, currentLoad.Distance, true);
                 stackedLoad = GetStackedLoad();
                 // Then group the rest with the load just added
                 for (int i = 1; i < currentStackedLoads.Count; i++)
                 {
                     currentStackedLoads[i].Switch(stackConveyor.TransportSection.Route, currentLoad.Distance, true);
                     stackedLoad.Group(currentStackedLoads[i], new Vector3(0, (TrayHeight + 0.005f) * i, 0));
                 }
             }
         }
     }
     //// Add short delay before releasing first load from the stack
     releaseLoadTimer.OnElapsed += ReleaseLoad_OnElapsed;
     releaseLoadTimer.Start();
 }
コード例 #3
0
 private void MoveLoadToStack()
 {
     if (currentLoad != null)
     {
         if (stackedLoad != null)
         {
             currentLoad.Switch(stackConveyor.TransportSection.Route, currentLoad.Distance, true);
             var stackY = (currentLoad.Height + 0.005f) * (stackedLoad.Grouped.Items.Count + 1); // create empty space between loads
             stackedLoad.Group(currentLoad, new Vector3(0, stackY, 0));
         }
         else
         {
             currentLoad.Switch(stackConveyor.TransportSection.Route, currentLoad.Distance, true);
         }
     }
 }