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(); }