Exemplo n.º 1
0
            public override void OnInspectorGUI()
            {
                if (Application.isPlaying)
                {
                    Titlebar("你不能在运行过程中改变它", Color.red);
                }
                serializedObject.Update();
                controller.editor.colliderRead.CheckValue();
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.isDraw"), new GUIContent("绘制碰撞体"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("isGlobal"), new GUIContent("是否为全局碰撞体"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.isOpen"), new GUIContent("是否打开"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.appendTransform"), new GUIContent("目标物体"), true);
                controller.editor.colliderRead.colliderType = (ColliderType)EditorGUILayout.EnumPopup("碰撞体种类", (CollideTypecZh)controller.editor.colliderRead.colliderType);

                switch (controller.GetColliderType())
                {
                case ColliderType.Sphere:
                    Titlebar("球体", Color.cyan);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.radius"), new GUIContent("┗━I 半径"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.positionOffset"), new GUIContent("┗━I 偏移坐标"), true);

                    break;

                case ColliderType.Capsule:
                    Titlebar("胶囊体", Color.cyan);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.radius"), new GUIContent("┗━I 半径"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.length"), new GUIContent("┗━I 长度"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.positionOffset"), new GUIContent("┗━I 偏移坐标"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.staticDirection"), new GUIContent("┗━I 朝向"), true);

                    break;

                case ColliderType.OBB:
                    Titlebar("立方体", Color.cyan);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.boxSize"), new GUIContent("┗━I 尺寸"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.positionOffset"), new GUIContent("┗━I 偏移坐标"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.staticDirection"), new GUIContent("┗━I 朝向"), true);
                    break;

                default:
                    break;
                }
                controller.editor.colliderRead.collideFunc = (CollideFunc)EditorGUILayout.EnumPopup("┗━I 碰撞体功能", (CollideFuncZh)controller.editor.colliderRead.collideFunc);
                if (controller.editor.colliderRead.collideFunc == 0)
                {
                    controller.editor.colliderRead.collideFunc = CollideFunc.OutsideLimit;
                }
                controller.editor.colliderRead.colliderChoice = (ColliderChoice)EditorGUILayout.EnumPopup("┗━I 碰撞体属性", (ColliderChoiceZh)controller.editor.colliderRead.colliderChoice);

                // EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.isConnectWithBody"), new GUIContent("Is Connect With Body"), true);
                if (!Application.isPlaying)
                {
                    controller.Refresh();
                    serializedObject.ApplyModifiedProperties();
                }
            }
            public override void OnInspectorGUI()
            {
                if (Application.isPlaying)
                {
                    Titlebar("You can't change it on runtime", Color.red);
                }
                serializedObject.Update();
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.isDraw"), new GUIContent("Is Draw"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("isGlobal"), new GUIContent("Is Global"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.isOpen"), new GUIContent("Is Open"), true);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.colliderType"), new GUIContent("Collider Type"), true);

                switch (controller.GetColliderType())
                {
                case ColliderType.Sphere:
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.radius"), new GUIContent("┗━I Radius"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.positionOffset"), new GUIContent("┗━I Position Offset"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.collideFunc"), new GUIContent("┗━I Collider Func"), true);
                    break;

                case ColliderType.Capsule:
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.radius"), new GUIContent("┗━I Radius"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.length"), new GUIContent("┗━I Length"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.positionOffset"), new GUIContent("┗━I Position Offset"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.staticDirection"), new GUIContent("┗━I Direction"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.collideFunc"), new GUIContent("┗━I Collider Func"), true);
                    break;

                case ColliderType.OBB:
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.boxSize"), new GUIContent("┗━I BoxSize"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.positionOffset"), new GUIContent("┗━I Position Offset"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.staticDirection"), new GUIContent("┗━I Direction"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.collideFunc"), new GUIContent("┗━I Collider Func"), true);
                    break;

                default:
                    break;
                }
                EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.colliderChoice"), new GUIContent("┗━I Collider Choice"), true);

                // EditorGUILayout.PropertyField(serializedObject.FindProperty("editor.colliderRead.isConnectWithBody"), new GUIContent("Is Connect With Body"), true);
                if (!Application.isPlaying)
                {
                    controller.Refresh();
                    serializedObject.ApplyModifiedProperties();
                }
            }