public int Raise(ObjectPlacementPath path, int currentPathHeight) { currentPathHeight += path.Settings.ManualConstructionSettings.HeightAdjustmentSettings.ManualHeightAdjustmentSettings.RaiseAmount; ObjectPlacementBoxStackSegmentActions.SetHeightForSegments(path.GetAllSegments(), currentPathHeight); return(currentPathHeight); }
public int Lower(ObjectPlacementBlock block, int currentBlockHeight) { currentBlockHeight -= block.Settings.ManualConstructionSettings.HeightAdjustmentSettings.ManualHeightAdjustmentSettings.LowerAmount; ObjectPlacementBoxStackSegmentActions.SetHeightForSegments(block.GetAllSegments(), currentBlockHeight); return(currentBlockHeight); }
public void OnPaddingSettingsChanged() { if (_isActive) { ObjectPlacementBoxStackSegmentActions.SetPaddingForSegments(_blockSegments, _paddingSettings.PaddingAlongExtensionPlane, _paddingSettings.PaddingAlongGrowDirection); for (int segmentIndex = 1; segmentIndex < _blockSegments.Count; ++segmentIndex) { AppendSegmentToSegment(_blockSegments[segmentIndex], _blockSegments[segmentIndex - 1]); } SceneView.RepaintAll(); } }
public void OnSubdivisionSettingsChanged() { if (_isActive) { if (_subdivisionSettings.UseSubdivision) { _subdivisionApplyOperation.ApplySubdivisionToEntireBlock(_blockSegments, _subdivisionSettings); } else { ObjectPlacementBoxStackSegmentActions.ClearHideFlagsForAllStacksInSegments(_blockSegments, ObjectPlacementBoxHideFlags.BlockApplySubdivisions); } SceneView.RepaintAll(); } }
public void OnPaddingSettingsChanged() { if (_isActive && !_tileConnectionSettings.UseTileConnections) { ObjectPlacementBoxStackSegmentActions.SetPaddingForSegments(_pathSegments, _paddingSettings.PaddingAlongExtensionPlane, _paddingSettings.PaddingAlongGrowDirection); ReconnectAllSegments(); HandleStackOverlapForAllStacksInAllSegments(); if (_borderSettings.UseBorders) { _borderApplyOperation.ApplyBordersToAllPathSegments(_pathSegments, _borderSettings); } SceneView.RepaintAll(); } }
public void OnBorderSettingsChanged() { if (_isActive) { if (_borderSettings.UseBorders) { _borderApplyOperation.ApplyBordersToAllPathSegments(_pathSegments, _borderSettings); } else { ObjectPlacementBoxStackSegmentActions.ClearHideFlagsForAllStacksInSegments(_pathSegments, ObjectPlacementBoxHideFlags.PathApplyBorders); } SceneView.RepaintAll(); } }
private void AppendOrRemoveStacksToAllSegments(int deltaNumberOfStacks) { if (deltaNumberOfStacks > 0) { if (CanExcludeCorners()) { LastSegment.GetStackByIndex(0).ClearHideFlagForAllBoxes(ObjectPlacementBoxHideFlags.BlockExcludeCorners); LastSegment.GetStackByIndex(LastSegment.NumberOfStacks - 1).ClearHideFlagForAllBoxes(ObjectPlacementBoxHideFlags.BlockExcludeCorners); } int currentNumberOfStacksInSegments = FirstSegment.NumberOfStacks; ObjectPlacementBoxStackSegmentActions.ExtendSegmentsByAmount(_blockSegments, deltaNumberOfStacks); AdjustHeightForStackRangeInAllSegments(currentNumberOfStacksInSegments); } else { ObjectPlacementBoxStackSegmentActions.ShrinkSegmentsByAmount(_blockSegments, Mathf.Abs(deltaNumberOfStacks)); } }
private void ExtendOrShrinkBlockAlongExtensionPlane() { // Construct a new extension plane in order to take into account the block's Y offset Plane extensionPlane = _blockExtensionPlane.Plane; Vector3 pointOnBlockExtensionPlane = _blockExtensionPlane.PlaneQuad.Center; pointOnBlockExtensionPlane += extensionPlane.normal * _manualConstructionSettings.OffsetAlongGrowDirection; extensionPlane = new Plane(extensionPlane.normal, pointOnBlockExtensionPlane); Vector3 extensionPlaneIntersectionPoint; if (MouseCursor.Instance.IntersectsPlane(extensionPlane, out extensionPlaneIntersectionPoint)) { Vector3 toIntersectionPoint = extensionPlaneIntersectionPoint - _blockExtensionPlane.Plane.ProjectPoint(FirstSegment.FirstStackBasePosition); if (!FirstSegment.ExtensionDirection.IsPointingInSameGeneralDirection(toIntersectionPoint)) { ObjectPlacementBoxStackSegmentActions.ReverseExtensionDirectionForSegments(_blockSegments); _segmentExtensionDirection = FirstSegment.ExtensionDirection; } if (!toIntersectionPoint.IsPointingInSameGeneralDirection(_segmentCollectionExtensionDirection)) { RemoveLastNumberOfSegments(_blockSegments.Count - 1); _segmentCollectionExtensionDirection *= -1.0f; } // Calculate the number of stacks for all segments float adjacentSideLength = FirstSegment.ExtensionDirection.GetAbsDot(toIntersectionPoint); float numberOfStacks = adjacentSideLength / (FirstSegment.GetBoxSizeAlongNormalizedDirection(_segmentExtensionDirection) + _paddingSettings.PaddingAlongExtensionPlane); int integerNumberOfStacks = (int)numberOfStacks + 1; // Calculate the number of segments adjacentSideLength = toIntersectionPoint.GetAbsDot(_segmentCollectionExtensionDirection); float numberOfSegments = adjacentSideLength / (FirstSegment.GetBoxSizeAlongNormalizedDirection(_segmentCollectionExtensionDirection) + _paddingSettings.PaddingAlongExtensionPlane); int integerNumberOfSegments = (int)numberOfSegments + 1; int newNumberOfStacksInSegments = integerNumberOfStacks; int newNumberOfSegmentsInBlock = integerNumberOfSegments; if (AllShortcutCombos.Instance.Enable1To1RatioBlockAdjustment.IsActive()) { int min = Mathf.Min(newNumberOfSegmentsInBlock, newNumberOfStacksInSegments); newNumberOfStacksInSegments = min; newNumberOfSegmentsInBlock = min; } // Append or remove stacks from the segments based on the new number of stacks int deltaNumberOfStacks = newNumberOfStacksInSegments - FirstSegment.NumberOfStacks; AppendOrRemoveStacksToAllSegments(deltaNumberOfStacks); // Append or remove segments from the block based on the new number of segments int deltaNumberOfSegments = newNumberOfSegmentsInBlock - _blockSegments.Count; AppendOrRemoveSegmentsToBlock(deltaNumberOfSegments); // Apply any subdivision if necessary and adjust the corner exclusion hide flags. We need to do this every // time the block is updated because when the block shrinks or grows, its structure is affected and so is // the way in which subdivision and corner exclusion is applied. if (_subdivisionSettings.UseSubdivision) { _subdivisionApplyOperation.ApplySubdivisionToEntireBlock(_blockSegments, _subdivisionSettings); } AdjustCornerExclusionHideFlagsForEntireBlock(); SceneView.RepaintAll(); } }