示例#1
0
        private void ReleaseLine()
        {
            if (_lineRenderer == null)
            {
                return;
            }
            _drawing = false;
            Vector3[] originalPositions = new Vector3[_lineRenderer.positionCount];
            _lineRenderer.GetPositions(originalPositions);

            ILineModel lineModel = new LineModel
            {
                Guid              = Guid.NewGuid().ToString("N"),
                DisplayName       = BrushService.GetBrushShape().ToString(),
                Layer             = _lineRenderer.sortingOrder,
                WidthCurve        = _lineRenderer.widthCurve,
                Gradient          = _lineRenderer.colorGradient,
                IsEmissionEnabled = BrushService.IsEmissionEnabled(),
                EmissionIntensity = BrushService.GetBrushEmissionIntensity(),
                LineGameObject    = _lineRenderer,
                Shape             = BrushService.GetBrushShape(),
                EmissionColor     = BrushService.GetBrushEmissionColor(),

                EmissionProperty    = new EmissionProperty(),
                ScaleProperty       = new ScaleProperty(),
                KochLineProperty    = new KochLineProperty(),
                KochTrailProperty   = new KochTrailProperty(),
                PhyllotaxisProperty = new PhyllotaxisProperty()
            };

            lineModel.EmissionProperty.IsEmissionReactOnAudio = BrushService.GetBrushEmissionReactOnAudio();
            lineModel.EmissionProperty.EmissionBandBuffer     = BrushService.GetBrushEmissionBandBuffer();
            lineModel.EmissionProperty.EmissionThreshold      = BrushService.GetBrushEmissionThreshold();
            lineModel.EmissionProperty.EmissionFrequencyType  = BrushService.GetBrushEmissionFrequencyType();

            lineModel.ScaleProperty.IsScaleReactOnAudio = BrushService.GetBrushScaleReactOnAudio();
            lineModel.ScaleProperty.ScaleBandBuffer     = BrushService.GetBrushScaleBandBuffer();
            lineModel.ScaleProperty.ScaleMultiplier     = BrushService.GetBrushScaleMultiplier();
            lineModel.ScaleProperty.ScaleThreshold      = BrushService.GetBrushScaleThreshold();
            lineModel.ScaleProperty.ScaleFrequencyType  = BrushService.GetBrushScaleFrequencyType();

            lineModel.KochLineProperty.IsKochEnabled       = BrushService.GetBrushKochEnabled();
            lineModel.KochLineProperty.ShapePointAmount    = _shapePointAmout;
            lineModel.KochLineProperty.ListStartGeneration = BrushService.GetBrushStartGeneration();
            lineModel.KochLineProperty.AnimationCurve      = BrushService.GetBrushAnimationCurve();
            lineModel.KochLineProperty.UseBezierCurves     = BrushService.GetBrushUseBezierCurves();
            lineModel.KochLineProperty.BezierVertexCount   = BrushService.GetBrushBezierVertexCount();
            lineModel.KochLineProperty.KochAudioBand       = BrushService.GetBrushKochAudioBand();
            lineModel.KochLineProperty.OriginalPositions   = originalPositions;

            lineModel.KochTrailProperty.IsTrailEnabled   = BrushService.GetBrushTrailEnabled();
            lineModel.KochTrailProperty.TrailSpeedMinMax = BrushService.GetBrushTrailSpeedMinMax();
            lineModel.KochTrailProperty.TrailTimeMinMax  = BrushService.GetBrushTrailTimeMinMax();
            lineModel.KochTrailProperty.TrailWidthMinMax = BrushService.GetBrushTrailWidthMinMax();

            lineModel.PhyllotaxisProperty.Degree                  = BrushService.GetBrushDegree();
            lineModel.PhyllotaxisProperty.Scale                   = BrushService.GetBrushScale();
            lineModel.PhyllotaxisProperty.NumberStart             = BrushService.GetBrushNumberStart();
            lineModel.PhyllotaxisProperty.StepSize                = BrushService.GetBrushStepSize();
            lineModel.PhyllotaxisProperty.MaxIterations           = BrushService.GetBrushMaxIterations();
            lineModel.PhyllotaxisProperty.UseLerping              = BrushService.GetBrushUseLerping();
            lineModel.PhyllotaxisProperty.LerpFrequencyType       = BrushService.GetBrushLerpFrequencyType();
            lineModel.PhyllotaxisProperty.LerpAudioBand           = BrushService.GetBrushLerpAudioBand();
            lineModel.PhyllotaxisProperty.SpeedMinMax             = BrushService.GetBrushSpeedMinMax();
            lineModel.PhyllotaxisProperty.LerpInterpolationCurve  = BrushService.GetBrushLerpInterpolationCurve();
            lineModel.PhyllotaxisProperty.Repeat                  = BrushService.GetBrushRepeat();
            lineModel.PhyllotaxisProperty.Invert                  = BrushService.GetBrushInvert();
            lineModel.PhyllotaxisProperty.UseScaling              = BrushService.GetBrushUseScaling();
            lineModel.PhyllotaxisProperty.ScaleFrequencyType      = BrushService.GetBrushScalePhylloFrequencyType();
            lineModel.PhyllotaxisProperty.ScaleAudioBand          = BrushService.GetBrushScaleAudioBand();
            lineModel.PhyllotaxisProperty.ScaleMinMax             = BrushService.GetBrushScaleMinMax();
            lineModel.PhyllotaxisProperty.UseScaleCurve           = BrushService.GetBrushUseScaleCurve();
            lineModel.PhyllotaxisProperty.ScaleInterpolationCurve = BrushService.GetBrushScaleInterpolationCurve();
            lineModel.PhyllotaxisProperty.InterpolationSpeed      = BrushService.GetBrushInterpolationSpeed();

            AddLineSignal.Dispatch(lineModel);
        }