public void EnableEnergyBar(ICECreatureEBTAdapter _adapter)
        {
            Init(_adapter);

            if (m_EnergyBarGameObject != null)
            {
                m_EnergyBarGameObject.SetActive(true);
            }
        }
        public void Init(ICECreatureEBTAdapter _adapter)
        {
            m_Adapter = _adapter;

            if (m_Adapter == null || m_Adapter.Controller == null || m_Adapter.Display == null || ReferenceObject == null)
            {
                return;
            }

            if (m_EnergyBarGameObject == null)
            {
                m_EnergyBarGameObject = GameObject.Instantiate(ReferenceObject.gameObject);
            }

            if (m_EnergyBarGameObject != null)
            {
                m_EnergyBarGameObject.transform.SetParent(m_Adapter.Display.transform, false);
                EnergyBarFollowObject _EnergyBarFollowObject = m_EnergyBarGameObject.GetComponent <EnergyBarFollowObject>();

                if (_EnergyBarFollowObject)
                {
                    _EnergyBarFollowObject.followObject = m_Adapter.transform.gameObject;
                    _EnergyBarFollowObject.worldCamera  = new ObjectFinder(typeof(Camera), "/Main Camera", "MainCamera", ObjectFinder.Method.ByTag);
                    _EnergyBarFollowObject.offset       = Offset;
                    _EnergyBarFollowObject.offset.y    += VerticalOffset;
                }


                m_EnergyBar = m_EnergyBarGameObject.GetComponent <EnergyBar>();
                if (m_EnergyBar)
                {
                    m_EnergyBar.valueMin         = 0;
                    m_EnergyBar.valueMax         = (int)GetMaxValue(Value);
                    m_EnergyBar.animationEnabled = false;
                }
            }
        }
        public override void OnInspectorGUI()
        {
            Info.HelpButtonIndex = 0;
            ICECreatureEBTAdapter _adapter = (ICECreatureEBTAdapter)target;

            EditorGUILayout.Separator();
            ICEEditorLayout.BeginHorizontal();
            _adapter.Display = (Canvas)EditorGUILayout.ObjectField("Display", _adapter.Display, typeof(Canvas), true);
            ICEEditorLayout.EndHorizontal();

            EditorGUILayout.Separator();
            ICEEditorLayout.Label("Offsets", false);
            EditorGUI.indentLevel++;
            _adapter.InitialOffset = ICEEditorLayout.DefaultSlider("Initial Offset", "", _adapter.InitialOffset, 0.01f, -10, 10, 0, "");
            _adapter.LineOffset    = ICEEditorLayout.DefaultSlider("Line Offset", "", _adapter.LineOffset, 0.01f, 0, 10, 0, "");
            EditorGUI.indentLevel--;

            EditorGUILayout.Separator();
            ICEEditorLayout.Label("Status Bars", false);
            EditorGUI.indentLevel++;
            for (int _i = 0; _i < _adapter.Bars.Count; _i++)
            {
                ICEEnergyBarObject _bar = _adapter.Bars[_i];

                ICEEditorLayout.BeginHorizontal();
                _bar.Value = (ICEEnergyBarDataType)ICEEditorLayout.EnumPopup("Status Value #" + (_i + 1), "", _bar.Value);

                if (ICEEditorLayout.ButtonUp())
                {
                    ICEEnergyBarObject _obj = _adapter.Bars[_i];
                    _adapter.Bars.RemoveAt(_i);

                    if (_i - 1 < 0)
                    {
                        _adapter.Bars.Add(_obj);
                    }
                    else
                    {
                        _adapter.Bars.Insert(_i - 1, _obj);
                    }

                    return;
                }


                if (ICEEditorLayout.ButtonDown())
                {
                    ICEEnergyBarObject _obj = _adapter.Bars[_i];
                    _adapter.Bars.RemoveAt(_i);

                    if (_i + 1 > _adapter.Bars.Count)
                    {
                        _adapter.Bars.Insert(0, _obj);
                    }
                    else
                    {
                        _adapter.Bars.Insert(_i + 1, _obj);
                    }

                    return;
                }

                if (GUILayout.Button("COPY", ICEEditorStyle.CMDButtonDouble))
                {
                    _adapter.Bars.Add(new ICEEnergyBarObject(_bar));
                }

                if (GUILayout.Button("X", ICEEditorStyle.CMDButton))
                {
                    _adapter.Bars.RemoveAt(_i);
                    --_i;
                }
                ICEEditorLayout.EndHorizontal();

                EditorGUI.indentLevel++;
                ICEEditorLayout.BeginHorizontal();
                _bar.ReferenceObject = (EnergyBar)EditorGUILayout.ObjectField("Reference", _bar.ReferenceObject, typeof(EnergyBar), true);
                ICEEditorLayout.EndHorizontal();

                ICEEditorLayout.BeginHorizontal();
                _bar.Offset = ICEEditorLayout.OffsetGroup("Offset", _bar.Offset);
                ICEEditorLayout.EndHorizontal();

                _bar.VerticalOffset = _adapter.InitialOffset + (_adapter.LineOffset * (_adapter.Bars.Count - _i));


                EditorGUI.indentLevel--;
            }

            EditorGUI.indentLevel--;

            ICEEditorLayout.BeginHorizontal();
            ICEEditorLayout.Label("Add Status Value", false);
            GUILayout.FlexibleSpace();
            if (ICEEditorLayout.Button("ADD", "", ICEEditorStyle.CMDButtonDouble))
            {
                _adapter.Bars.Add(new ICEEnergyBarObject());
            }
            ICEEditorLayout.EndHorizontal();

            EditorGUILayout.Separator();
        }