Ejemplo n.º 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 RenderGizmos(ObjectPlacementExtensionPlane extensionPlane)
        {
            ObjectPlacementExtensionPlaneRenderSettings renderSettings = extensionPlane.RenderSettings;
            XZOrientedQuad3D planeQuad = extensionPlane.PlaneQuad;

            planeQuad.SetScale(renderSettings.PlaneScale);

            // Note: Add a small offset to avoid Z wars when the extension plane sits on top of other objects.
            const float quadOffset = 0.005f;

            GizmosEx.RenderXZOrientedQuad(planeQuad, renderSettings.PlaneColor, quadOffset);
            GizmosEx.RenderXZOrientedQuadBorderLines(planeQuad, renderSettings.PlaneBorderLineColor, quadOffset);

            // Render the plane normals
            List <Vector3> quadCornerPoints  = planeQuad.GetCornerPoints();
            Vector3        offsetToEndOfLine = extensionPlane.Plane.normal * renderSettings.PlaneNormalLineLength;

            foreach (Vector3 quadCornerPoint in quadCornerPoints)
            {
                GizmosEx.RenderLine(quadCornerPoint, quadCornerPoint + offsetToEndOfLine, renderSettings.PlaneNormalLineColor);
            }
        }
Ejemplo n.º 3
0
        public void SetData(ObjectPlacementPathManualConstructionSessionData sessionData)
        {
            if (!_isActive)
            {
                _path                    = sessionData.Path;
                _pathSegments            = sessionData.PathSegments;
                _pathExtensionPlane      = sessionData.PathExtensionPlane;
                _tileConnectionGridCells = sessionData.TileConnectionGridCells;

                _startObject = sessionData.StartObject;
                _startObjectHierarchyWorldOrientedBox = _startObject.GetHierarchyWorldOrientedBox();

                _pathSettings               = _path.Settings;
                _tileConnectionSettings     = _pathSettings.TileConnectionSettings;
                _manualConstructionSettings = _pathSettings.ManualConstructionSettings;
                _heightAdjustmentSettings   = _manualConstructionSettings.HeightAdjustmentSettings;
                _paddingSettings            = _manualConstructionSettings.PaddingSettings;
                _borderSettings             = _manualConstructionSettings.BorderSettings;

                _pathNoTileConnectionsObjectPlacementDataCalculator.Path   = _path;
                _pathWithTileConnectionsObjectPlacementDataCalculator.Path = _path;
            }
        }