protected override void StopDrawing()
        {
            base.StopDrawing();
            for (int i = _triangleHelper.Length - 1; i >= 0; i--)
            {
                if (_triangleHelper[i] != null)
                {
                    Destroy(_triangleHelper[i].gameObject);
                }

                _triangleHelper[i] = null;
            }

            Destroy(_previewMeshFilter.gameObject);
            _previewVertices.Clear();
            _triangles.Clear();
            _vertices.Clear();
            LastDrawnObjects.Push(_completeMeshFilter.gameObject);
            if (_completeMeshFilter.mesh.vertices.Length <= 2)
            {
                Undo();
            }
            _previewMesh  = null;
            _completeMesh = null;
        }
        // Base stop drawing method
        protected override void StopDrawing()
        {
            base.StopDrawing();
            LastDrawnObjects.Push(_currentLineRenderer.gameObject);
            switch (Mode)
            {
            case LineMode.FreeHand:
                FreeHandDraw(false);
                break;

            case LineMode.Straight:
                _positions.RemoveAt(_positions.Count - 1);
                SetPositions();
                break;
            }
            _positions.Clear();
            Mode = LineMode.None;
        }
        /// <summary>
        /// Draw measurement positions
        /// </summary>
        public override void DrawObject()
        {
            int pointId = clickCounter % 2;

            switch (pointId)
            {
            case 0:
                var prefab            = MeasureObjectPrefab.gameObject;
                var measureGameObject = Instantiate <GameObject>(prefab, Vector3.zero, Quaternion.identity, transform);
                currentMeasureObjectManager = measureGameObject.GetComponent <MeasurementObjectManager>();
                LastDrawnObjects.Push(measureGameObject);
                break;

            case 1:
                currentMeasureObjectManager.DoMeasurement();
                break;
            }
            currentMeasureObjectManager.SetPoint(pointId, CurrentPosition, true);
            clickCounter++;
        }
Ejemplo n.º 4
0
        protected override void StopDrawing()
        {
            base.StopDrawing();

            if (!_writtenLine.enabled)
            {
                Destroy(_writtenLine.gameObject);
            }
            else
            {
                LastDrawnObjects.Push(_writtenLine.gameObject);
                //SnapToPlane();
            }

            if (!_writtenPoint.enabled)
            {
                Destroy(_writtenPoint.gameObject);
            }
            else
            {
                LastDrawnObjects.Push(_writtenPoint.gameObject);
            }
        }
        /// <summary>
        /// Base draw method, draws points
        /// </summary>
        public override void DrawObject()
        {
            var point = Instantiate <GameObject>(_pointPrefab, CurrentPosition, Quaternion.identity, transform);

            LastDrawnObjects.Push(point);
        }