示例#1
0
 protected void SelectAction(bool isHit, RaycastHit hitInfo)
 {
     if (isHit == true) {
         hitTr = hitInfo.transform;
         if (isExtruding == false) {
             if (selectionState == SelectionState.Vertex) {
                 hitPoint = hitTr.GetComponent<Point>();
                 if (hitPoint != null) {
                     hitPoint.SetPointEnabled(true);
                 }
             }
             if (selectionState == SelectionState.Face) {
                 hitPrimitiveObject = hitTr.GetComponent<PrimitiveObject>();
                 if (hitPrimitiveObject != null && hitPrimitiveObject.IsSelected == false) {
                     hitPrimitiveObject.SetColor(Color.red);
                 }
             } else if (selectionState == SelectionState.Object) {
                 hitPrimitiveObject = hitTr.GetComponent<PrimitiveObject>();
                 if (hitPrimitiveObject != null && hitPrimitiveObject.IsSelected == false) {
                     hitPrimitiveObject.GetCompound().SetColor(Color.red);
                 }
             }
         }
     }
 }
示例#2
0
 protected void RestoreSelectionAction()
 {
     if (selectionState == SelectionState.Vertex) {
         if (hitPoint != null) {
             hitPoint.SetPointEnabled(false);
         }
     }
     if (selectionState == SelectionState.Face) {
         if (hitPrimitiveObject != null && hitPrimitiveObject.IsSelected == false) {
             hitPrimitiveObject.RestoreColor();
         }
     } else if (selectionState == SelectionState.Object) {
         if (hitPrimitiveObject != null && hitPrimitiveObject.GetCompound().IsSelected == false) {
             hitPrimitiveObject.GetCompound().RestoreColor();
         }
     }
     hitTr = null;
     hitPrimitiveObject = null;
     hitPoint = null;
 }
示例#3
0
 public void ExtrudeFaceOnce(float magnitude, bool isContinous)
 {
     if (selectionState != SelectionState.Face) {
         return;
     }
     if (selectedPrimitiveObject != null) {
         selectedPrimitiveObject.GetCompound().ExtrudeFace(selectedPrimitiveObject, magnitude, isContinous);
         if (selectedPrimitiveObject != null) {
             selectedPrimitiveObject.GetCompound().FinishExtrude();
             isExtruding = false;
         }
     }
 }
示例#4
0
    protected ModelerState SelectionActions(ModelerState modelerState)
    {
        if (Input.GetMouseButtonDown(0)) {
            if (EventSystem.current.IsPointerOverGameObject() == false) {
                if (selectedPrimitiveObject != null) {
                    selectedPrimitiveObject.GetCompound().SelectAll(false);
                    selectedPrimitiveObject = null;
                }
            }
            switch (selectionState) {
                case SelectionState.Object:

                    if (hitPrimitiveObject != null) {
                        if (selectedPrimitiveObject != null) {
                            selectedPrimitiveObject.GetCompound().SelectAll(false);
                        }
                        selectedPrimitiveObject = hitTr.GetComponent<PrimitiveObject>();
                        selectedPrimitiveObject.GetCompound().SelectAll(true);
                    }
                    break;
                case SelectionState.Face:
                    if (hitPrimitiveObject != null) {
                        if (selectedPrimitiveObject != null) {
                            selectedPrimitiveObject.IsSelected = false;
                        }
                        selectedPrimitiveObject = hitTr.GetComponent<PrimitiveObject>();
                        selectedPrimitiveObject.IsSelected = true;
                    }
                    break;
                case SelectionState.Edge:
                    break;
                case SelectionState.Vertex:

                    break;
                default:
                    break;
            }
        }
        return modelerState;
    }