using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(OptitrackRigidBody))]
public class OptitrackRigidBodyEditor : Editor
{
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        OptitrackRigidBody rigidBody = (OptitrackRigidBody)target;

        GUILayout.Space(10);
        EditorGUILayout.LabelField("RigidBody 상태", EditorStyles.boldLabel);

        GUI.backgroundColor = rigidBody.isRigidBodyFound ? Color.green : Color.red;
        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
        GUILayout.Label(rigidBody.isRigidBodyFound ? "연결됨" : "연결 안됨", 
            new GUIStyle(EditorStyles.boldLabel) { alignment = TextAnchor.MiddleCenter });
        EditorGUILayout.EndHorizontal();
        GUI.backgroundColor = Color.white;

        if (!rigidBody.isRigidBodyFound)
        {
            EditorGUILayout.HelpBox("Motive에서 RigidBody가 활성화되어 있는지 확인해주세요.", MessageType.Warning);
        }

        GUILayout.Space(10);
    }
}
