private void EndEdit()
        {
            if (m_selection != null)
            {
                m_selection.Unselect();
                m_selection.enabled = false;
            }

            m_isEditing = false;
        }
예제 #2
0
파일: PBPolyShape.cs 프로젝트: lbm7926/Imp
        public bool Click(Camera camera, Vector3 pointer)
        {
            if (!m_isEditing)
            {
                return(false);
            }

            SceneSelection selection = new SceneSelection();
            float          result    = PBUtility.PickVertex(camera, pointer, 20, m_selection.Transform, m_selection.Positions, ref selection);

            if (result != Mathf.Infinity)
            {
                if (m_selection.Positions.Count >= 3)
                {
                    m_selection.Unselect();
                    m_selection.Select(selection.vertex);
                    return(true);
                }
            }
            else
            {
                if (Stage == 0)
                {
                    Ray   ray = camera.ScreenPointToRay(pointer);
                    float enter;

                    Plane plane = new Plane(m_selection.transform.up, m_selection.transform.position);
                    if (plane.Raycast(ray, out enter))
                    {
                        Vector3 position = ray.GetPoint(enter);
                        position = m_selection.Transform.InverseTransformPoint(position);
                        m_selection.Add(position);
                        m_positions.Add(position);
                    }

                    m_target.CreateShapeFromPolygon(m_selection.Positions, 0.001f, false);
                }
            }

            return(false);
        }