Beispiel #1
0
        private void Update()
        {
            if (!_drawingEnable)
            {
                return;
            }

            if (Input.GetMouseButtonDown(0))
            {
                _drawPolygon = new Polygon();
                _isDrawing   = true;
                StartDrawSignal.Dispatch();
            }

            if (_isDrawing)
            {
                _drawPolygon.AddNextVertex(Camera.main.ScreenToWorldPoint(Input.mousePosition));

                if (!Input.GetMouseButton(0))
                {
                    _isDrawing = false;
                    UserDrawedPolygonSignal.Dispatch(_drawPolygon);
                }
            }
        }