Esempio n. 1
0
        /// <summary>
        /// Sets the currently active tool.
        /// </summary>
        public void SetTool(int toolIndex)
        {
            switch (toolIndex)
            {
            default:
            case 0:
                activeTool = penTool;
                break;

            case 1:
                activeTool = highlighterTool;
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new instance of the DrawingLine. Will instantiate a new prefab.
        /// </summary>
        public DrawingLine(DrawingTool tool, PointerInput input, Vector3 worldPoint, Color color)
        {
            this.tool = tool;

            rendererInstance = Object.Instantiate(tool.LinePrefab, worldPoint, Quaternion.identity);

            float          pressure   = input.Pressure ?? 1.0f;
            float          curveWidth = tool.SizePressureCurve.Evaluate(pressure);
            AnimationCurve curve      = AnimationCurve.Constant(0.0f, 1.0f, curveWidth);

            rendererInstance.widthCurve = curve;

            rendererInstance.positionCount = 1;
            rendererInstance.SetPosition(0, worldPoint);

            color.a = tool.LineAlpha;
            rendererInstance.startColor = color;
            rendererInstance.endColor   = color;

            lastPosition = worldPoint;
            lineLength   = 0;
        }
Esempio n. 3
0
 protected virtual void Awake()
 {
     activeTool = penTool;
 }