Ejemplo n.º 1
0
        void SetupBrushUI()
        {
            m_AnnotationPointer = ObjectUtils.CreateGameObjectWithComponent <AnnotationPointer>(rayOrigin, false);
            m_OriginalAnnotationPointerLocalScale = m_AnnotationPointer.transform.localScale;
            var brushSize = m_Preferences.brushSize;

            m_AnnotationPointer.Resize(brushSize);

            var brushSizeUi = this.InstantiateUI(m_BrushSizePrefab, rayOrigin: rayOrigin);

            m_BrushSizeUI = brushSizeUi.GetComponent <BrushSizeUI>();

            var transform = brushSizeUi.transform;
            var scale     = transform.localScale;

            transform.SetParent(alternateMenuOrigin, false);
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.Euler(-90, 0, 0);
            transform.localScale    = scale;

            m_BrushSizeUI.onValueChanged = value =>
            {
                var sliderValue = Mathf.Lerp(MinBrushSize, MaxBrushSize, value);
                m_Preferences.brushSize = sliderValue;
                m_AnnotationPointer.Resize(sliderValue);
            };
            m_BrushSizeChanged = m_BrushSizeUI.ChangeSliderValue;
        }