private static void DrawEnvironmentSurfaceSettings(ICECreatureControl _control)
        {
            ICEEditorLayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(_control.Creature.Environment.SurfaceHandler.Enabled == false);
            WorldObjectEditor.DrawObjectHeaderLine(ref _control.Creature.Environment.SurfaceHandler.Enabled, ref _control.Creature.Environment.SurfaceHandler.Foldout, EditorHeaderType.FOLDOUT_BOLD, "Surfaces", "");

            EditorGUI.EndDisabledGroup();

            if (ICEEditorLayout.AddButton("Adds a new surface rule"))
            {
                _control.Creature.Environment.SurfaceHandler.Surfaces.Add(new SurfaceDataObject());
                _control.Creature.Environment.SurfaceHandler.Enabled = true;
            }


            if (ICEEditorLayout.SaveButton("Saves surface data to file"))
            {
                CreatureEditorIO.SaveEnvironmentSurfaceToFile(_control.Creature.Environment.SurfaceHandler, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton("Loads surface data  to file"))
            {
                _control.Creature.Environment.SurfaceHandler = CreatureEditorIO.LoadEnvironmentSurfaceFromFile(_control.Creature.Environment.SurfaceHandler);
            }
            if (ICEEditorLayout.ResetButton("Resets the surface data"))
            {
                _control.Creature.Environment.SurfaceHandler.Reset();
            }

            _control.Creature.Environment.SurfaceHandler.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Environment.SurfaceHandler.Enabled);
            ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_SURFACE);

            if (_control.Creature.Environment.SurfaceHandler.Enabled == true && _control.Creature.Environment.SurfaceHandler.Surfaces.Count == 0)
            {
                _control.Creature.Environment.SurfaceHandler.Surfaces.Add(new SurfaceDataObject());
                _control.Creature.Environment.SurfaceHandler.Foldout = true;
            }

            // CONTENT BEGIN
            if (WorldObjectEditor.BeginObjectContentOrReturn(EditorHeaderType.FOLDOUT_BOLD, _control.Creature.Environment.SurfaceHandler))
            {
                return;
            }

            _control.Creature.Environment.SurfaceHandler.GroundScanInterval = ICEEditorLayout.MaxDefaultSlider("Ground Scan Interval (secs.)", "Defines the interval for the ground check", _control.Creature.Environment.SurfaceHandler.GroundScanInterval, 0.25f, 0, ref _control.Creature.Environment.SurfaceHandler.GroundScanIntervalMaximum, 1, Info.ENVIROMENT_SURFACE_SCAN_INTERVAL);

            for (int i = 0; i < _control.Creature.Environment.SurfaceHandler.Surfaces.Count; ++i)
            {
                // HEADER BEGIN
                SurfaceDataObject _surface = _control.Creature.Environment.SurfaceHandler.Surfaces[i];

                if (_surface.Name == "")
                {
                    _surface.Name = "Surface Rule #" + (i + 1);
                }

                ICEEditorLayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(_surface.Enabled == false);
                _surface.Foldout = ICEEditorLayout.Foldout(_surface.Foldout, _surface.Name);
                EditorGUI.EndDisabledGroup();


                if (ICEEditorLayout.ListDeleteButton <SurfaceDataObject>(_control.Creature.Environment.SurfaceHandler.Surfaces, _surface, "Removes the selected surface rule"))
                {
                    if (_control.Creature.Environment.SurfaceHandler.Surfaces.Count == 0)
                    {
                        _control.Creature.Environment.SurfaceHandler.Enabled = false;
                    }

                    return;
                }

                GUILayout.Space(5);
                if (ICEEditorLayout.ListUpDownButtons <SurfaceDataObject>(_control.Creature.Environment.SurfaceHandler.Surfaces, i))
                {
                    return;
                }

                _surface.Enabled = ICEEditorLayout.EnableButton("Activates/deactivates the  the selected surfaces rule", _surface.Enabled);

                ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_SURFACE_RULE);
                // HEADER END

                if (_surface.Foldout)
                {
                    EditorGUI.BeginDisabledGroup(_surface.Enabled == false);
                    ICEEditorLayout.BeginHorizontal();
                    _surface.Name = ICEEditorLayout.Text("Name", "", _surface.Name);
                    if (ICEEditorLayout.ResetButtonSmall())
                    {
                        _surface.Name = "";
                    }
                    ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_SURFACE_RULE_NAME);
                    //_surface.Interval = ICEEditorLayout.DefaultSlider( "Interval", "", _surface.Interval, 0.005f, 0, 30, 1, Info.ENVIROMENT_SURFACE_RULE_INTERVAL );

                    //ICEEditorStyle.SplitterByIndent( EditorGUI.indentLevel + 1 );

                    DrawEnvironmentTextures(_surface);

                    ICEEditorLayout.Label("Procedures", true, Info.ENVIROMENT_SURFACE_RULE_PROCEDURES);
                    EditorGUI.indentLevel++;
                    EditorGUI.BeginDisabledGroup(_surface.Textures.Count == 0);
                    _surface.UseBehaviourModeKey = ICEEditorLayout.Toggle("Behaviour", "", _surface.UseBehaviourModeKey, Info.ENVIROMENT_SURFACE_BEHAVIOUR);
                    if (_surface.UseBehaviourModeKey)
                    {
                        EditorGUI.indentLevel++;
                        _surface.BehaviourModeKey = BehaviourEditor.BehaviourSelect(_control, "Behaviour", "Reaction to this impact", _surface.BehaviourModeKey, "SURFACE_" + _surface.Name.ToUpper(), Info.ENVIROMENT_SURFACE_BEHAVIOUR);
                        EditorGUI.indentLevel--;
                    }
                    EditorHeaderType _header = EditorHeaderType.TOGGLE;
                    CreatureObjectEditor.DrawInfluenceObject(_surface.Influences, _header, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.ENVIROMENT_SURFACE_INFLUENCES);
                    CreatureObjectEditor.DrawFootstepAudioObject(_surface.Footsteps, _header, Info.ENVIROMENT_SURFACE_AUDIO);
                    CreatureObjectEditor.DrawAudioObject(_surface.Audio, _header, Info.ENVIROMENT_SURFACE_AUDIO);
                    CreatureObjectEditor.DrawEffectObject(_control, _surface.Effect, _header, Info.ENVIROMENT_SURFACE_EFFECT);
                    EditorGUI.EndDisabledGroup();
                    EditorGUI.indentLevel--;
                    EditorGUILayout.Separator();
                    EditorGUI.EndDisabledGroup();
                    ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
                }
            }

            ICEEditorLayout.DrawListAddLine <SurfaceDataObject>(_control.Creature.Environment.SurfaceHandler.Surfaces, new SurfaceDataObject(), false, "Add Surface Rule");

            WorldObjectEditor.EndObjectContent();
            // CONTENT END
        }
        /// <summary>
        /// Draws the behaviour mode rule.
        /// </summary>
        /// <param name="_index">_index.</param>
        /// <param name="_list">_list.</param>
        public static void DrawBehaviourModeRule(ICECreatureControl _control, BehaviourModeObject _mode, int _index, List <BehaviourModeRuleObject> _list, string _key)
        {
            BehaviourModeRuleObject _rule = _list[_index];

            if (_rule == null)
            {
                return;
            }

            if (_list.Count > 1)
            {
                EditorGUI.indentLevel++;

                ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);

                ICEEditorLayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(_rule.Enabled == false);
                _rule.Foldout = EditorGUILayout.Foldout(_rule.Foldout, _key + " Rule #" + (_index + 1), ICEEditorStyle.Foldout);
                EditorGUI.EndDisabledGroup();

                GUILayout.FlexibleSpace();

                ICEEditorLayout.StatusButton("ACTIVE", _rule.Active == false, Color.green);

                if (ICEEditorLayout.CopyButtonMiddle())
                {
                    _list.Add(new BehaviourModeRuleObject(_rule));
                }

                GUILayout.Space(5);
                if (ICEEditorLayout.ListDeleteButton <BehaviourModeRuleObject>(_list, _rule, "Removes this rule."))
                {
                    return;
                }

                if (ICEEditorLayout.ListUpDownButtons <BehaviourModeRuleObject>(_list, _list.IndexOf(_rule)))
                {
                    return;
                }



                _rule.Enabled = ICEEditorLayout.EnableButton("Enables/disables this rule", _rule.Enabled);

                ICEEditorLayout.EndHorizontal(Info.BEHAVIOUR_MODE_RULE);
            }
            else
            {
                _rule.Foldout = true;
                _rule.Enabled = true;
            }

            if (_rule.Foldout)
            {
                EditorHeaderType _header     = EditorHeaderType.FOLDOUT_ENABLED_BOLD;
                EditorHeaderType _sub_header = EditorHeaderType.FOLDOUT_ENABLED_BOLD;

                EditorGUI.BeginDisabledGroup(_rule.Enabled == false);

                // WEIGHTEDRANDOM BEGIN
                if (_list.Count > 1 && _mode.RulesOrderType == SequenceOrderType.WEIGHTEDRANDOM)
                {
                    _rule.Weight = ICEEditorLayout.DefaultSlider("Weight", "Weight Value for WEIGHTEDRANDOM Sequence Type, relative to other rules weight value", _rule.Weight, Init.DECIMAL_PRECISION, 0, 100, 1, Info.BEHAVIOUR_MODE_RULE_WEIGHT);
                }
                // WEIGHTEDRANDOM END

                EditorGUI.indentLevel++;

                // CUSTOM LENGTH BEGIN
                if (_list.Count > 1 || _rule.Link.Enabled)
                {
                    DrawBehaviourCustomLength(_control, _rule, _header);
                }
                // CUSTOM LENGTH END

                CreatureBehaviourEditor.DrawBehaviourAnimation(_control, _mode, _rule, _header);
                CreatureBehaviourEditor.DrawBehaviourMove(_control, _mode, _rule, _header);
                CreatureObjectEditor.DrawInfluenceObject(_mode, _rule.Influences, _header, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.BEHAVIOUR_INFLUENCES);
                CreatureObjectEditor.DrawInventoryActionObject(_control, _rule.Inventory, _header, Info.BEHAVIOUR_INVENTORY);
                CreatureObjectEditor.DrawAudioObject(_rule.Audio, _header, Info.BEHAVIOUR_AUDIO);
                CreatureObjectEditor.DrawEventsObject(_control, _rule.Events, _header, _sub_header, Info.BEHAVIOUR_EVENTS);
                CreatureObjectEditor.DrawLookDataObject(_rule.Look, _header, Info.BEHAVIOUR_LOOK);
                CreatureObjectEditor.DrawEffectObject(_control, _rule.Effect, _header, Info.BEHAVIOUR_EFFECT);
                CreatureBehaviourEditor.DrawBehaviourModeRuleLinkObject(_control, _list, _rule.Link, _header, Info.BEHAVIOUR_LINK, "", "", _key + "_" + _index);

                EditorGUILayout.Separator();
                EditorGUI.EndDisabledGroup();
                EditorGUI.indentLevel--;
            }

            if (_list.Count > 1)
            {
                EditorGUI.indentLevel--;
            }
        }