Example #1
0
        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;
            }
        }
 public void AdjustHeightForSegments(List <ObjectPlacementBoxStackSegment> segments, int indexOfFirstSegmentToAdjust, int indexOfFirstStackToAdjust, ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettings automaticRandomHeightAdjustmentSettings)
 {
     for (int segmentIndex = indexOfFirstSegmentToAdjust; segmentIndex < segments.Count; ++segmentIndex)
     {
         AdjustSegmentHeight(segments[segmentIndex], indexOfFirstStackToAdjust, automaticRandomHeightAdjustmentSettings);
     }
 }
        public void AdjustSegmentHeight(ObjectPlacementBoxStackSegment segment, int indexOfFirstStackToAdjust, ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettings automaticRandomHeightAdjustmentSettings)
        {
            Range <int> randomValueRange       = new Range <int>(automaticRandomHeightAdjustmentSettings.MinHeight, automaticRandomHeightAdjustmentSettings.MaxHeight);
            int         numberOfStacksToAdjust = segment.NumberOfStacks - indexOfFirstStackToAdjust;

            segment.SetHeightForStacksStartingAt(indexOfFirstStackToAdjust, RandomValueGeneration.GenerateIntRandomValuesInRange(randomValueRange, numberOfStacksToAdjust));
        }
 public ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettingsView(ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettings settings)
 {
     _settings = settings;
 }
        public static void SendToInterestedListeners(ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettings automaticRandomHeightAdjustmentSettings)
        {
            var message = new ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettingsWereChangedMessage(automaticRandomHeightAdjustmentSettings);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }
 public ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettingsWereChangedMessage(ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettings automaticRandomHeightAdjustmentSettings)
     : base(MessageType.ObjectPlacementBlockAutomaticRandomHeightAdjustmentSettingsWereChanged)
 {
     _automaticRandomHeightAdjustmentSettings = automaticRandomHeightAdjustmentSettings;
 }