Untitled

mail@pastecode.io avatar
unknown
plain_text
9 days ago
2.2 kB
3
Indexable
Never
using NUnit.Framework;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Policy;
using UnityEditor;
using UnityEngine;


[CustomEditor(typeof(InteractableObject))]
public class InteractableObjectEditor : Editor
{
    bool[] group_states = new bool[11];
    string[] group_names = new string[11] { "Climb", "Fly", "Invincible", "Talk", "Dash", "Interact", "Smash", "Teleport", "Enter", "Jump",
        "Stealth" };

    static List<String> climb_variables = new List<String>() { "wall_spline" };
    static List<String> fly_variables = new List<String>() { "fly_spline" };
    static List<String> inv_variables = new List<String>() { "block_box" };
    static List<String> talk_variables = new List<String>() { "start_dialogue" };
    static List<String> dash_variables = new List<String>() { "move_spline" };
    static List<String> event_variables = new List<String>() { "event_animator" };
    static List<String> smash_variables = new List<String>() { "smash_object", "explosive_force", "effect_radius" };
    static List<String> teleport_variables = new List<String>() { "next_location" };
    static List<String> enter_variables = new List<String>() { "scene_name", "scene_transform" };
    static List<String> jump_variables = new List<String>() { "jump_spline" };
    static List<String> stealth_variables = new List<String>() { };



    List<string>[] group_variables = new List<string>[11] { climb_variables,fly_variables,inv_variables,talk_variables,dash_variables,
        event_variables,smash_variables,teleport_variables,enter_variables,jump_variables,stealth_variables}; 

    public override void OnInspectorGUI()
    {
        EditorGUILayout.PropertyField(serializedObject.FindProperty("event_type"));

        for (int i = 0; i < group_names.Length; i++)
        {
            group_states[i] = EditorGUILayout.Foldout(group_states[i], group_names[i]);
            if (group_states[i])
            {
                foreach(String prop_name in group_variables[i])
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty(prop_name));
                }
            }
        }


    }
}
Leave a Comment