private void RenderBlockUnderManualConstruction(ObjectPlacementBlock block) { List <ObjectPlacementBoxStackSegment> allBlockSegments = block.GetAllSegments(); ObjectPlacementBlockManualConstructionRenderSettings renderSettings = block.RenderSettings.ManualConstructionRenderSettings; Vector3 boxOffsetAlongExtensionPlaneNormal = block.Settings.ManualConstructionSettings.OffsetAlongGrowDirection * block.ExtensionPlane.normal; foreach (ObjectPlacementBoxStackSegment segment in allBlockSegments) { for (int stackIndex = 0; stackIndex < segment.NumberOfStacks; ++stackIndex) { ObjectPlacementBoxStack stack = segment.GetStackByIndex(stackIndex); if (stack.IsOverlappedByAnotherStack) { continue; } for (int boxIndex = 0; boxIndex < stack.NumberOfBoxes; ++boxIndex) { ObjectPlacementBox placementBox = stack.GetBoxByIndex(boxIndex); if (placementBox.IsHidden) { continue; } OrientedBox orientedBox = placementBox.OrientedBox; orientedBox.Center += boxOffsetAlongExtensionPlaneNormal; GizmosEx.RenderOrientedBoxEdges(orientedBox, renderSettings.BoxBorderLineColor); } } } }
public void RenderGizmos(ObjectPlacementBlock block) { if (block.IsUnderManualConstruction) { RenderBlockUnderManualConstruction(block); } }
public int Raise(ObjectPlacementBlock block, int currentBlockHeight) { currentBlockHeight += block.Settings.ManualConstructionSettings.HeightAdjustmentSettings.ManualHeightAdjustmentSettings.RaiseAmount; ObjectPlacementBoxStackSegmentActions.SetHeightForSegments(block.GetAllSegments(), currentBlockHeight); return(currentBlockHeight); }
public static void PerformRegistrationForObjectPlacementBlock(ObjectPlacementBlock objectPlacementBlock) { if (objectPlacementBlock != null) { MessageListenerDatabase listenerDatabase = MessageListenerDatabase.Instance; listenerDatabase.UnregisterListener(objectPlacementBlock); listenerDatabase.RegisterListenerForMessage(MessageType.ObjectPlacementBlockExcludeCornersWasChanged, objectPlacementBlock); listenerDatabase.RegisterListenerForMessage(MessageType.ObjectPlacementBlockPaddingSettingsWereChanged, objectPlacementBlock); listenerDatabase.RegisterListenerForMessage(MessageType.ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettingsWereChanged, objectPlacementBlock); listenerDatabase.RegisterListenerForMessage(MessageType.ObjectPlacementBlockHeightAdjustmentModeWasChanged, objectPlacementBlock); listenerDatabase.RegisterListenerForMessage(MessageType.ObjectPlacementBlockSubdivisionSettingsWereChanged, objectPlacementBlock); listenerDatabase.RegisterListenerForMessage(MessageType.UndoRedoWasPerformed, objectPlacementBlock); } }
public void SetData(ObjectPlacementBlockManualConstructionSessionData sessionData) { if (!_isActive) { _block = sessionData.Block; _blockSegments = sessionData.BlockSegments; _blockExtensionPlane = sessionData.BlockExtensionPlane; _startObject = sessionData.StartObject; _startObjectHierarchyWorldOrientedBox = _startObject.GetHierarchyWorldOrientedBox(); _blockObjectPlacementDataCalculator.Block = _block; _manualConstructionSettings = _block.Settings.ManualConstructionSettings; _heightAdjustmentSettings = _manualConstructionSettings.HeightAdjustmentSettings; _automaticRandomHeightAdjustmentSettings = _heightAdjustmentSettings.AutomaticRandomHeightAdjustmentSettings; _paddingSettings = _manualConstructionSettings.PaddingSettings; _subdivisionSettings = _manualConstructionSettings.SubdivisionSettings; } }