// отложенная обработка нажатия по точке private IEnumerator PointView_MouseDown_Coroutine(CVPoint point) { switch (CurState) { case State.BuildLine: Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (curAction != null && curAction.IsDone) { curAction.Undo(); yield return(null); } RaycastHit raycastHit = new RaycastHit(); if (Physics.Raycast(ray, out raycastHit)) { CVPoint correctPoint = raycastHit.transform.gameObject.GetComponent <CVPoint>(); if (correctPoint != null) { activePoints.ToXor(correctPoint); if (activePoints.Count == activePoints.MaxCount) { curAction = new CBuildLineAction(this, activePoints.Bottom, correctPoint); curAction.Do(); activePoints.Remove(correctPoint); } } } break; } yield return(null); }
// отложенная обработка события выбора отрезка private IEnumerator LineView_Selected_Coroutine(CVLine view, CVLineSegment segment) { switch (CurState) { case State.SetAngle: if (activeSegments.Count != 0 && segment.GetCommonPoint(activeSegments.Top) == null) { activeSegments.Clear(); } activeSegments.ToXor(segment); break; case State.BuildLine: Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (curAction != null && curAction.IsDone) { curAction.Undo(); yield return(null); } RaycastHit raycastHit = new RaycastHit(); if (activePoints.Top != null && Physics.Raycast(ray, out raycastHit)) { CVLineSegment correctSegment = raycastHit.transform.gameObject.GetComponent <CVLineSegment>(); curAction = new CBuildLineAction(this, activePoints.Top, correctSegment, raycastHit.point); curAction.Do(); } break; case State.DivideLine: activeSegments.ToXor(segment); break; case State.Static: break; } yield return(null); }