示例#1
0
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Destroy all boxes"))
        {
            Undo.RecordObject(polygonAreaEffector, "Destroy all boxes");
            polygonAreaEffector.DestroyArea();
            EditorUtility.SetDirty(polygonAreaEffector);
        }

        if (GUILayout.Button("Invert all directions"))
        {
            Undo.RecordObject(polygonAreaEffector, "Invert all directions");
            polygonAreaEffector.InvertDirection();
            EditorUtility.SetDirty(polygonAreaEffector);
        }

        if (GUILayout.Button("Log path info"))
        {
            Debug.Log("Lineaer Length: " + polygonAreaEffector.LinearLength);
            Debug.Log("Total Area: " + polygonAreaEffector.TotalArea);
        }
        if (selectedBox != null)
        {
            if (GUILayout.Button("Invert selected direction"))
            {
                Undo.RecordObject(polygonAreaEffector, "Invert selected direction");
                polygonAreaEffector.InvertBox(selectedBox);
                EditorUtility.SetDirty(polygonAreaEffector);
            }
            if (GUILayout.Button("Log selected box info"))
            {
                Debug.Log("Direction: " + selectedBox.direction);
                Debug.Log("Connected direction: " + selectedBox.connectionDirection);
                Debug.Log("Relative direction: " + selectedBox.RelativeDirection(selectedBox.origin));
                Debug.Log("Angle" + Mathf.Atan2(selectedBox.RelativeDirection(selectedBox.origin).y, selectedBox.RelativeDirection(selectedBox.origin).x) * Mathf.Rad2Deg);
            }
        }

        ShowEditorProperty("mask");
        ShowEditorProperty("force");
        ShowEditorProperty("forceOverTimeIncrementer");
        ShowEditorProperty("forceType");
        ShowEditorProperty("bakeBodies");
    }
示例#2
0
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Destroy all boxes"))
        {
            polygonAreaEffector.DestroyArea();
        }

        if (GUILayout.Button("Invert all directions"))
        {
            polygonAreaEffector.InvertDirection();
        }

        if (GUILayout.Button("Invert selected direction"))
        {
            polygonAreaEffector.InvertBox(selectedBox);
        }

        ShowEditorProperty("mask");
        ShowEditorProperty("force");
        ShowEditorProperty("forceOverTimeIncrementer");
    }