Beispiel #1
0
        private void AppendSegments(int numberOfSegmentsToAppend)
        {
            for (int segmentIndex = 0; segmentIndex < numberOfSegmentsToAppend; ++segmentIndex)
            {
                ObjectPlacementBoxStackSegment lastSegmentInBlock = LastSegment;
                ObjectPlacementBoxStackSegment segmentToAppend    = CreateNewSegment();
                segmentToAppend.SetExtensionDirection(_segmentExtensionDirection);
                segmentToAppend.Extend(FirstSegment.NumberOfStacks);

                AppendSegmentToSegment(segmentToAppend, lastSegmentInBlock);
            }
        }
        public void Attach2NewSegments()
        {
            if (_isActive)
            {
                RemoveSegmentsWithNoStacks();

                // First create the 2 new segments which will replace the current penultimate and last segments
                ObjectPlacementBoxStackSegment oldLastSegment        = LastSegment;
                ObjectPlacementBoxStackSegment newPenultimateSegment = CreateNewSegment();
                CreateNewSegment();

                // We will want the first stack in the new penultimate segment to replace the last stack in 'LastSegment'.
                // Otherwise, when this function is called, an additional box will suddenly appear in the scene apparently
                // out of nowhere and it doesn't look very good. Not to mention that it can be quite confusing :).
                oldLastSegment.Shrink(1);
                newPenultimateSegment.Extend(1);

                newPenultimateSegment.SetExtensionDirection(oldLastSegment.ExtensionDirection);
                if (CanRotateObjectsToFollowPath())
                {
                    newPenultimateSegment.SetRotationForAllStacks(oldLastSegment.StackRotation);
                    MakeSegmentFollowPath(LastSegment);
                }
                newPenultimateSegment.ConnectFirstStackToLastStackInSegment(oldLastSegment, CalculateSegmentConnectionOffset(newPenultimateSegment, oldLastSegment));

                AdjustHeightForEntireSegment(PenultimateSegment);

                UpdateStackOverlapDataForLast2Segments();
                if (_borderSettings.UseBorders)
                {
                    _borderApplyOperation.ApplyBordersToAllPathSegments(_pathSegments, _borderSettings);
                }
                if (_tileConnectionSettings.UseTileConnections)
                {
                    UpdateTileConnectionInformation();
                }
            }
        }