示例#1
0
 // Use this for initialization
 void Start()
 {
     am = amObj.GetComponent<AnimationManager> ();
     fs = faceSelObj.GetComponent<FaceSelection> ();
     hsTracker = hsObj.GetComponent<HighscoreTracker> ();
     sc = selectionControl.GetComponent<SelectionControl> ();
     cd = clkObj.GetComponent<ClickDetection> ();
 }
        public FaceSelection GetFaceSelection()
        {
            var fs = Document.Map.Data.GetOne <FaceSelection>();

            if (fs == null)
            {
                fs = new FaceSelection();
                Document.Map.Data.Add(fs);
            }
            return(fs);
        }
示例#3
0
        private FaceSelection GetSelection(MapDocument document)
        {
            var fs = document.Map.Data.GetOne <FaceSelection>();

            if (fs == null)
            {
                fs = new FaceSelection();
                document.Map.Data.Add(fs);
            }
            return(fs);
        }
示例#4
0
        private void HandleFaceSelect()
        {
            Event      e = Event.current;
            RaycastHit hit;

            if (EditorUtils.SceneViewMouseRaycast(GetHashCode(), e, out hit))
            {
                if ((e.type == EventType.MouseDown && e.button == 0))
                {
                    GridBlock block = hit.collider.GetComponent <GridBlock>();
                    if (block == null)
                    {
                        return;
                    }

                    Deselect();
                    _squareSel[0] = new FaceSelection(block, hit.normal);


                    _selectedQuad = FindQuad();
                    e.Use();
                }
                else if (e.type == EventType.MouseDrag && e.button == 0)
                {
                    GridBlock block = hit.collider.GetComponent <GridBlock>();
                    if (block == null)
                    {
                        return;
                    }

                    _squareSel[1] = new FaceSelection(block, hit.normal);


                    _selectedQuad = FindQuad();
                    e.Use();
                }
            }
            else if (e.type == EventType.MouseDown && e.button == 0) // Click on nothing
            {
                Deselect();
                e.Use();
            }
        }