예제 #1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            manager.Begin(new Vector2(Input.mousePosition.x, Input.mousePosition.y));
            _captureTick       = 0f;
            _lastMousePosition = Input.mousePosition;
            SetPenPosition();
            NewPen();
        }
        else if (Input.GetMouseButton(0))
        {
            if (_lastMousePosition != Input.mousePosition)
            {
                _captureTick += Time.deltaTime;

                if (_captureTick >= captureInterval)
                {
                    _captureTick = 0f;
                    manager.Update(new Vector2(Input.mousePosition.x, Input.mousePosition.y));
                    SetPenPosition();
                }
            }
        }
        if (Input.GetMouseButtonUp(0))
        {
            manager.End(new Vector2(Input.mousePosition.x, Input.mousePosition.y));
        }
    }