public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();


        bezier = (Bezier)target;
        GameObject obj = bezier.gameObject;

        lineObjects = GameObject.FindGameObjectsWithTag("BezierLine");

        bezier.UpdateManually();
        foreach (GameObject lineThing in lineObjects)
        {
            lineThing.GetComponent <Line>().ManualUpdate();
        }

        if (GUILayout.Button("New Point", GUILayout.MaxWidth(130), GUILayout.MaxHeight(20)))
        {
            bezier.AddPoint(false, null);
        }
        if (GUILayout.Button("Loop/Unloop Path", GUILayout.MaxWidth(130), GUILayout.MaxHeight(20)))
        {
            bezier.LoopUnloop();
        }
        if (GUILayout.Button("Show/Hide", GUILayout.MaxWidth(130), GUILayout.MaxHeight(20)))
        {
            bezier.HideShow();
        }
        //if (GUILayout.Button("PrintPoints", GUILayout.MaxWidth(130), GUILayout.MaxHeight(20)))
        //{
        //    bezier.PrintPointsList();
        //}
    }
Esempio n. 2
0
        private void CanvasBox_MouseDown(object sender, MouseEventArgs e)
        {
            switch (CurrentState)
            {
            case State.WAIT:
            {
                //TODO Select
                break;
            }

            case State.SELECTED:
            {
                FirstPoint = e.Location;
                ChangeState(State.MOVE);
                break;
            }

            case State.ROTATE:
            {
                Layers[SelectedLayer].Rotate(e.Location, (int)RotateNumerical.Value);
                FullUpdateCanvas();
                ChangeState(State.SELECTED);
                break;
            }

            case State.DRAW_LINE:
            {
                FirstPoint = e.Location;
                break;
            }

            case State.DRAW_BEZIER:
            {
                ActiveBezier.AddPoint(e.Location);
                if (e.Button == MouseButtons.Right)
                {
                    ActiveBezier.Finish();
                    AddFigure(ActiveBezier);
                    ActiveBezier = new Bezier();
                }
                break;
            }

            case State.DRAW_PARA:
            {
                FirstPoint = e.Location;
                break;
            }

            case State.DRAW_ANGLE:
            {
                FirstPoint = e.Location;
                break;
            }
            }
        }