public void Draw(GridEditorSettings settings, bool isDefaultState)
        {
            string  tempStr;
            Vector3 tempV3;

            EditorGUI.BeginChangeCheck();
            tempStr = EditorGUILayout.TextField("Name", name);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(settings, "Change Prefab State Name");
                if (!isDefaultState)
                {
                    name = tempStr;
                }
                else
                {
                    settings.CreatePrefabStateForSelection(new PrefabState(tempStr, rotation, shift));
                }

                settings.UpdatePrefabStatesPopupList();
            }

            EditorGUI.BeginChangeCheck();
            tempV3 = EditorGUILayout.Vector3Field("Rotation", rotation);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(settings, "Change Prefab Rotation");
                if (!isDefaultState)
                {
                    rotation = tempV3;
                }
                else
                {
                    settings.CreatePrefabStateForSelection(new PrefabState(name, tempV3, shift));
                }
            }

            EditorGUI.BeginChangeCheck();
            tempV3 = EditorGUILayout.Vector3Field("Shift", shift);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(settings, "Change Prefab Shift");
                if (!isDefaultState)
                {
                    shift = tempV3;
                }
                else
                {
                    settings.CreatePrefabStateForSelection(new PrefabState(name, rotation, tempV3));
                }
            }
        }
Beispiel #2
0
        public void Draw(GridEditorSettings settings, bool isDefaultState)
        {
            EditorGUI.BeginChangeCheck();
            string _name = EditorGUILayout.TextField("Name", name);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(settings, "Change Prefab State Name");
                if (!isDefaultState)
                {
                    name = _name;
                }
                else
                {
                    settings.CreatePrefabStateForSelection(new PrefabState(_name, rotation, shift));
                }

                settings.UpdatePrefabStatesPopupList();
            }

            EditorGUI.BeginChangeCheck();
            Vector3 _rotation = EditorGUILayout.Vector3Field("Rotation", rotation);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(settings, "Change Prefab Rotation");
                if (!isDefaultState)
                {
                    rotation = _rotation;
                }
                else
                {
                    settings.CreatePrefabStateForSelection(new PrefabState(name, _rotation, shift));
                }
            }

            EditorGUI.BeginChangeCheck();
            Vector3 _shift = EditorGUILayout.Vector3Field("Shift", shift);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(settings, "Change Prefab Shift");
                if (!isDefaultState)
                {
                    shift = _shift;
                }
                else
                {
                    settings.CreatePrefabStateForSelection(new PrefabState(name, rotation, _shift));
                }
            }
        }