Exemplo n.º 1
0
        public static void DrawTargetBehaviour(ICECreatureControl _control, TargetObject _target, string _default_key = "", params string[] _params)
        {
            if (_target == null)
            {
                return;
            }

            string _title = "Creature Behaviour " + _target.Behaviour.BehaviourTitleSuffix();
            string _hint  = "";
            string _help  = Info.TARGET_BEHAVIOUR;

            ICEEditorLayout.BeginHorizontal();

            _target.Behaviour.Foldout = ICEEditorLayout.Foldout(_target.Behaviour.Foldout, _title, _hint, false);

            EditorGUI.BeginDisabledGroup(_target.Behaviour.UseSelectiveBehaviour == true);
            _target.Behaviour.UseAdvancedBehaviour = ICEEditorLayout.CheckButtonSmall("ADV", "Allows advanced behaviour settings", _target.Behaviour.UseAdvancedBehaviour);
            EditorGUI.EndDisabledGroup();

            _target.Behaviour.UseSelectiveBehaviour = ICEEditorLayout.CheckButtonSmall("SEL", "Allows selective behaviour settings", _target.Behaviour.UseSelectiveBehaviour);

            ICEEditorLayout.EndHorizontal(_help);

            if (!_target.Behaviour.Foldout)
            {
                return;
            }

            EditorGUI.indentLevel++;

            if (_target.Behaviour.UseSelectiveBehaviour)
            {
                EditorGUILayout.HelpBox("Sorry, this feature is unfortunately not available in the current version!", MessageType.Info);
            }
            else if (_target.Behaviour.UseAdvancedBehaviour)
            {
                string _title_1 = (_params.Length > 1 ?_params[1] : "Standard");
                string _title_2 = (_params.Length > 2 ?_params[2] : "Rendezvous");

                string _default_key_1 = _default_key + "_TS_" + (_params.Length > 1 ?_params[1] : "Standard") + "_" + _target.TargetName;
                string _default_key_2 = _default_key + "_TR_" + (_params.Length > 2 ?_params[2] : "Rendezvous") + "_" + _target.TargetName;

                _target.Behaviour.BehaviourModeKey        = BehaviourEditor.BehaviourSelect(_control, _title_1, "Move behaviour while approching or avoiding the target", _target.Behaviour.BehaviourModeKey, _default_key_1.ToUpper(), Info.TARGET_BEHAVIOUR_STANDARD);
                _target.Behaviour.BehaviourModeKeyReached = BehaviourEditor.BehaviourSelect(_control, _title_2, "Rendezvous behaviour while the final move position of the target was reached", _target.Behaviour.BehaviourModeKeyReached, _default_key_2.ToUpper(), Info.TARGET_BEHAVIOUR_RENDEZVOUS);
            }
            else
            {
                string _title_0 = (_params.Length > 0 ?_params[0]: "Standard");

                string _default_key_1 = _default_key + "_TS_" + (_params.Length > 1 ?_params[1] : "Standard") + "_" + _target.TargetName;

                _target.Behaviour.BehaviourModeKey = BehaviourEditor.BehaviourSelect(_control, _title_0, "Behaviour while the target is active.", _target.Behaviour.BehaviourModeKey, _default_key_1.ToUpper(), Info.TARGET_BEHAVIOUR_STANDARD);
            }

            EditorGUI.indentLevel--;
        }
        private static void DrawMissionOutpost(ICECreatureControl _control)
        {
            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);

            //HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();
            _control.Creature.Missions.Outpost.Foldout = ICEEditorLayout.Foldout(_control.Creature.Missions.Outpost.Foldout, "Outpost Mission");

            if (ICEEditorLayout.SaveButton())
            {
                CreatureEditorIO.SaveMissionOutpostToFile(_control.Creature.Missions.Outpost, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton())
            {
                _control.Creature.Missions.Outpost = CreatureEditorIO.LoadMissionOutpostFromFile(_control.Creature.Missions.Outpost);
            }
            if (ICEEditorLayout.ResetButton())
            {
                _control.Creature.Missions.Outpost = new OutpostObject();
            }

            _control.Creature.Missions.Outpost.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Missions.Outpost.Enabled);
            ICEEditorLayout.EndHorizontal(Info.MISSION_OUTPOST);
            //HEADER END

            if (!_control.Creature.Missions.Outpost.Foldout)
            {
                return;
            }

            EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Outpost.Enabled == false);
            EditorGUI.indentLevel++;
            TargetEditor.DrawMissionTarget(_control, _control.Creature.Missions.Outpost.Target, "Target", Info.MISSION_OUTPOST_TARGET);

            EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Outpost.Target.TargetGameObject == null);
            _control.Creature.Missions.Outpost.BehaviourFoldout = ICEEditorLayout.Foldout(_control.Creature.Missions.Outpost.BehaviourFoldout, "Behaviour", Info.MISSION_OUTPOST_BEHAVIOR, true);
            if (_control.Creature.Missions.Outpost.BehaviourFoldout)
            {
                _control.Creature.Missions.Outpost.BehaviourModeTravel     = BehaviourEditor.BehaviourSelect(_control, "Travel", "Move behaviour to reach the Outpost", _control.Creature.Missions.Outpost.BehaviourModeTravel, "OUTPOST_TRAVEL");
                _control.Creature.Missions.Outpost.BehaviourModeRendezvous = BehaviourEditor.BehaviourSelect(_control, "Rendezvous", "Idle behaviour after reaching the current target move position.", _control.Creature.Missions.Outpost.BehaviourModeRendezvous, "OUTPOST_RENDEZVOUS");
                if (_control.Creature.Missions.Outpost.Target.Move.HasRandomRange)
                {
                    _control.Creature.Missions.Outpost.BehaviourModeLeisure = BehaviourEditor.BehaviourSelect(_control, "Leisure", "Randomized leisure activities around the Outpost", _control.Creature.Missions.Outpost.BehaviourModeLeisure, "OUTPOST_LEISURE");
                }
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.indentLevel--;
            EditorGUI.EndDisabledGroup();


            EditorGUILayout.Separator();
        }
        private static void DrawMissionEscort(ICECreatureControl _control)
        {
            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);

            //HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();
            _control.Creature.Missions.Escort.Foldout = ICEEditorLayout.Foldout(_control.Creature.Missions.Escort.Foldout, "Escort Mission");

            if (ICEEditorLayout.SaveButton())
            {
                CreatureEditorIO.SaveMissionEscortToFile(_control.Creature.Missions.Escort, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton())
            {
                _control.Creature.Missions.Escort = CreatureEditorIO.LoadMissionEscortFromFile(_control.Creature.Missions.Escort);
            }
            if (ICEEditorLayout.ResetButton())
            {
                _control.Creature.Missions.Escort = new EscortObject();
            }

            _control.Creature.Missions.Escort.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Missions.Escort.Enabled);
            ICEEditorLayout.EndHorizontal(Info.MISSION_ESCORT);
            //HEADER END

            if (!_control.Creature.Missions.Escort.Foldout)
            {
                return;
            }

            EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Escort.Enabled == false);
            EditorGUI.indentLevel++;
            TargetEditor.DrawMissionTarget(_control, _control.Creature.Missions.Escort.Target, "Target", Info.MISSION_ESCORT_TARGET);

            EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Escort.Target.TargetGameObject == null);
            _control.Creature.Missions.Escort.BehaviourFoldout = ICEEditorLayout.Foldout(_control.Creature.Missions.Escort.BehaviourFoldout, "Behaviour", Info.MISSION_ESCORT_BEHAVIOUR, true);
            if (_control.Creature.Missions.Escort.BehaviourFoldout)
            {
                _control.Creature.Missions.Escort.BehaviourModeFollow  = BehaviourEditor.BehaviourSelect(_control, "Follow", "Move behaviour to follow and reach the leader", _control.Creature.Missions.Escort.BehaviourModeFollow, "ESCORT_FOLLOW");
                _control.Creature.Missions.Escort.BehaviourModeEscort  = BehaviourEditor.BehaviourSelect(_control, "Escort", "Move behaviour to escort the leader", _control.Creature.Missions.Escort.BehaviourModeEscort, "ESCORT");
                _control.Creature.Missions.Escort.BehaviourModeStandby = BehaviourEditor.BehaviourSelect(_control, "Standby", "Idle behaviour if the leader stops", _control.Creature.Missions.Escort.BehaviourModeStandby, "ESCORT_STANDBY");
                EditorGUI.indentLevel++;
                _control.Creature.Missions.Escort.DurationStandby = ICEEditorLayout.Slider("Duration (until IDLE)", "", _control.Creature.Missions.Escort.DurationStandby, 1, 0, 60);
                EditorGUI.indentLevel--;
                _control.Creature.Missions.Escort.BehaviourModeIdle = BehaviourEditor.BehaviourSelect(_control, "Idle", "Idle behaviour if the leader breaks for a longer time-span", _control.Creature.Missions.Escort.BehaviourModeIdle, "ESCORT_IDLE");
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.indentLevel--;
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Separator();
        }
        public static void DrawInRangeBehaviour(ICECreatureControl _control, ref string _leisure, ref string rendezvous, ref float _duration, ref bool _transit, float _range, int _index = 0)
        {
            _duration = ICEEditorLayout.DurationSlider("Duration Of Stay", "Desired duration of stay", _duration, Init.DURATION_OF_STAY_STEP, Init.DURATION_OF_STAY_MIN, Init.DURATION_OF_STAY_MAX, Init.DURATION_OF_STAY_DEFAULT, ref _transit);

            if (_transit == false)
            {
                EditorGUI.indentLevel++;

                if (_range > 0)
                {
                    _leisure = BehaviourEditor.BehaviourSelect(_control, "Leisure", "Randomized leisure activities after reaching the Random Range of the target. Please note, if the Random Range is adjusted to zero, leisure is not available.", _leisure, "WP_LEISURE" + (_index > 0?"_" + _index:""), Info.ESSENTIALS_BEHAVIOURS_LEISURE);
                }

                EditorGUI.BeginDisabledGroup(_duration == 0);
                rendezvous = BehaviourEditor.BehaviourSelect(_control, "Rendezvous", "Action behaviour after reaching the Stop Distance of the given target move position.", rendezvous, "WP_RENDEZVOUS" + (_index > 0?"_" + _index:""), Info.ESSENTIALS_BEHAVIOURS_RENDEZVOUS);
                EditorGUI.EndDisabledGroup();

                EditorGUI.indentLevel--;
            }
        }
        private static bool DrawMissionPatrolWaypoint(ICECreatureControl _control, int _index)
        {
            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);
            WaypointObject _waypoint = _control.Creature.Missions.Patrol.Waypoints.Waypoints[_index];

            if (_waypoint == null)
            {
                return(false);
            }

            // HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();
            _waypoint.WaypointFoldout = ICEEditorLayout.Foldout(_waypoint.WaypointFoldout, "Waypoint #" + (int)(_index + 1) + (!string.IsNullOrEmpty(_waypoint.TargetName) ? " (" + _waypoint.TargetName + ")": ""), "", true);

            if (ICEEditorLayout.ListDeleteButton <WaypointObject>(_control.Creature.Missions.Patrol.Waypoints.Waypoints, _waypoint))
            {
                return(true);
            }

            GUILayout.Space(5);
            if (ICEEditorLayout.ListUpDownButtons <WaypointObject>(_control.Creature.Missions.Patrol.Waypoints.Waypoints, _control.Creature.Missions.Patrol.Waypoints.Waypoints.IndexOf(_waypoint)))
            {
                return(true);
            }



            _waypoint.Enabled = ICEEditorLayout.EnableButton(_waypoint.Enabled);

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

            // CONTENT BEGIN
            if (_waypoint.WaypointFoldout)
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginDisabledGroup(_waypoint.Enabled == false);
                TargetEditor.DrawMissionTarget(_control, (TargetObject)_waypoint, "Target", Info.MISSION_PATROL_TARGET);

                ICEEditorLayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(_waypoint.UseCustomBehaviour == false);
                _waypoint.BehaviourFoldout = ICEEditorLayout.Foldout(_waypoint.BehaviourFoldout, "Behaviour", true);
                EditorGUI.EndDisabledGroup();
                _waypoint.UseCustomBehaviour = ICEEditorLayout.CheckButton("Override", "", _waypoint.UseCustomBehaviour, ICEEditorStyle.ButtonMiddle);
                ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL_CUSTOM_BEHAVIOUR);

                if (!_waypoint.UseCustomBehaviour)
                {
                    _waypoint.BehaviourFoldout = false;
                }

                if (_waypoint.BehaviourFoldout)
                {
                    _waypoint.BehaviourModeTravel = BehaviourEditor.BehaviourSelect(_control, "Travel", "Travel behaviour to reach this waypoint and to start this mission", _waypoint.BehaviourModeTravel, "WP_TRAVEL_" + (int)(_index + 1));
                    _waypoint.BehaviourModePatrol = BehaviourEditor.BehaviourSelect(_control, "Patrol", "Patrol behaviour to reach this waypoint", _waypoint.BehaviourModePatrol, "WP_PATROL_" + (int)(_index + 1));

                    BehaviourEditor.DrawInRangeBehaviour(_control,
                                                         ref _waypoint.BehaviourModeLeisure,
                                                         ref _waypoint.BehaviourModeRendezvous,
                                                         ref _waypoint.DurationOfStay,
                                                         ref _waypoint.IsTransitPoint,
                                                         _waypoint.Move.RandomRange,
                                                         (int)(_index + 1));

                    EditorGUILayout.Separator();
                }

                EditorGUI.EndDisabledGroup();
                EditorGUI.indentLevel--;
            }
            // CONTENT END


            return(false);
        }
        private static void DrawMissionPatrol(ICECreatureControl _control)
        {
            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);

            //HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();
            _control.Creature.Missions.Patrol.Foldout = ICEEditorLayout.Foldout(_control.Creature.Missions.Patrol.Foldout, "Patrol Mission");
            if (ICEEditorLayout.SaveButton())
            {
                CreatureEditorIO.SaveMissionPatrolToFile(_control.Creature.Missions.Patrol, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton())
            {
                _control.Creature.Missions.Patrol = CreatureEditorIO.LoadMissionPatrolFromFile(_control.Creature.Missions.Patrol);
            }
            if (ICEEditorLayout.ResetButton())
            {
                _control.Creature.Missions.Patrol = new PatrolObject();
            }
            _control.Creature.Missions.Patrol.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Missions.Patrol.Enabled);
            ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL);
            //HEADER END

            if (!_control.Creature.Missions.Patrol.Foldout)
            {
                return;
            }

            EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Patrol.Enabled == false);



            EditorGUILayout.Separator();

            EditorGUI.indentLevel++;
            _control.Creature.Missions.Patrol.BehaviourFoldout = ICEEditorLayout.Foldout(_control.Creature.Missions.Patrol.BehaviourFoldout, "Behaviour", Info.MISSION_OUTPOST_BEHAVIOR, true);
            if (_control.Creature.Missions.Patrol.BehaviourFoldout)
            {
                _control.Creature.Missions.Patrol.BehaviourModeTravel = BehaviourEditor.BehaviourSelect(_control, "Travel", "Default travel behaviour to reach the first waypoint", _control.Creature.Missions.Patrol.BehaviourModeTravel, "WP_TRAVEL");
                _control.Creature.Missions.Patrol.BehaviourModePatrol = BehaviourEditor.BehaviourSelect(_control, "Patrol", "Default patrol behaviour to reach the next waypoint", _control.Creature.Missions.Patrol.BehaviourModePatrol, "WP_PATROL");
                BehaviourEditor.DrawInRangeBehaviour(_control,
                                                     ref _control.Creature.Missions.Patrol.BehaviourModeLeisure,
                                                     ref _control.Creature.Missions.Patrol.BehaviourModeRendezvous,
                                                     ref _control.Creature.Missions.Patrol.DurationOfStay,
                                                     ref _control.Creature.Missions.Patrol.IsTransitPoint,
                                                     1);
                EditorGUILayout.Separator();
            }
            EditorGUI.indentLevel--;



            EditorGUI.indentLevel++;
            ICEEditorLayout.BeginHorizontal();

            int    _count_all   = _control.Creature.Missions.Patrol.Waypoints.Waypoints.Count;
            int    _count_valid = _control.Creature.Missions.Patrol.Waypoints.GetValidWaypoints().Count;
            string _title       = "Waypoints" + (_count_all > 0 ? " (" + _count_valid + "/" + _count_all + ")" : "");

            _control.Creature.Missions.Patrol.WaypointsFoldout = ICEEditorLayout.Foldout(_control.Creature.Missions.Patrol.WaypointsFoldout, _title, true);


            _control.Creature.Missions.Patrol.Waypoints.WaypointGroup = (GameObject)EditorGUILayout.ObjectField(_control.Creature.Missions.Patrol.Waypoints.WaypointGroup, typeof(GameObject), true, GUILayout.Width(65));
            _control.Creature.Missions.Patrol.Waypoints.WaypointGroup = null;

            //if( ICEEditorLayout.ButtonMiddle( "RESET", "Removes all waypoints." ) )
            //	_control.Creature.Missions.Patrol.Waypoints.Waypoints.Clear();

            if (ICEEditorLayout.ListClearButton <WaypointObject>(_control.Creature.Missions.Patrol.Waypoints.Waypoints))
            {
                return;
            }

            if (ICEEditorLayout.AddButtonSmall("Adds a new waypoint item."))
            {
                _control.Creature.Missions.Patrol.Waypoints.Waypoints.Add(new WaypointObject());
            }

            GUILayout.Space(5);
            ICEEditorLayout.ListFoldoutButtons <WaypointObject>(_control.Creature.Missions.Patrol.Waypoints.Waypoints);

            ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL_WAYPOINTS);
            if (_control.Creature.Missions.Patrol.WaypointsFoldout)
            {
                ICEEditorLayout.BeginHorizontal();
                _control.Creature.Missions.Patrol.Waypoints.Order = (WaypointOrderType)ICEEditorLayout.EnumPopup("Order Type", "", _control.Creature.Missions.Patrol.Waypoints.Order);
                EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Patrol.Waypoints.Order != WaypointOrderType.CYCLE);
                _control.Creature.Missions.Patrol.Waypoints.Ascending = !ICEEditorLayout.CheckButtonSmall("DESC", "descending order", !_control.Creature.Missions.Patrol.Waypoints.Ascending);
                EditorGUI.EndDisabledGroup();
                ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL_ORDER_TYPE);

                EditorGUILayout.Separator();
                for (int i = 0; i < _control.Creature.Missions.Patrol.Waypoints.Waypoints.Count; ++i)
                {
                    if (DrawMissionPatrolWaypoint(_control, i))
                    {
                        return;
                    }
                }
            }
            EditorGUI.indentLevel--;

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.Separator();
        }
        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
        }
        private static void DrawEnvironmentCollisionSettings(ICECreatureControl _control)
        {
            // IMPACT HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();

            EditorGUI.BeginDisabledGroup(_control.Creature.Environment.CollisionHandler.Enabled == false);
            WorldObjectEditor.DrawObjectHeaderLine(ref _control.Creature.Environment.CollisionHandler.Enabled, ref _control.Creature.Environment.CollisionHandler.Foldout, EditorHeaderType.FOLDOUT_BOLD, "Collisions", "");

            _control.Creature.Environment.CollisionHandler.AllowChildCollisions = ICEEditorLayout.CheckButtonSmall("ACC", "Allow Child Collisions", _control.Creature.Environment.CollisionHandler.AllowChildCollisions);
            _control.Creature.Environment.CollisionHandler.UseCollider          = ICEEditorLayout.CheckButtonSmall("COL", "Use Collider events", _control.Creature.Environment.CollisionHandler.UseCollider);
            _control.Creature.Environment.CollisionHandler.UseTrigger           = ICEEditorLayout.CheckButtonSmall("TRI", "Use Trigger events", _control.Creature.Environment.CollisionHandler.UseTrigger);
            EditorGUI.BeginDisabledGroup(_control.GetComponent <CharacterController>() == null);
            _control.Creature.Environment.CollisionHandler.UseCharacterController = ICEEditorLayout.CheckButtonSmall("CON", "Use CharacterController events", _control.Creature.Environment.CollisionHandler.UseCharacterController);
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(5);
            EditorGUI.EndDisabledGroup();

            if (ICEEditorLayout.AddButton("Adds a new collision rule"))
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject());
                _control.Creature.Environment.CollisionHandler.Enabled = true;
            }

            if (ICEEditorLayout.SaveButton("Saves collision data to file"))
            {
                CreatureEditorIO.SaveEnvironmentCollisionToFile(_control.Creature.Environment.CollisionHandler, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton("Loads collision data  to file"))
            {
                _control.Creature.Environment.CollisionHandler = CreatureEditorIO.LoadEnvironmentCollisionFromFile(_control.Creature.Environment.CollisionHandler);
            }
            if (ICEEditorLayout.ResetButton("Resets the collision data"))
            {
                _control.Creature.Environment.CollisionHandler.Reset();
            }

            _control.Creature.Environment.CollisionHandler.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Environment.CollisionHandler.Enabled);
            ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION);
            // IMPACT HEADER END

            if (_control.Creature.Environment.CollisionHandler.Enabled == true && _control.Creature.Environment.CollisionHandler.Collisions.Count == 0)
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject());
                _control.Creature.Environment.CollisionHandler.Foldout = true;
            }

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

            for (int i = 0; i < _control.Creature.Environment.CollisionHandler.Collisions.Count; i++)
            {
                CollisionDataObject _collision = _control.Creature.Environment.CollisionHandler.Collisions[i];

                if (_collision != null)
                {
                    if (_collision.Name.Trim() == "")
                    {
                        _collision.Name = "Collision Rule #" + (i + 1);
                    }

                    // IMPACT RULE HEADER BEGIN
                    ICEEditorLayout.BeginHorizontal();
                    EditorGUI.BeginDisabledGroup(_collision.Enabled == false);
                    _collision.Foldout = ICEEditorLayout.Foldout(_collision.Foldout, _collision.Name);
                    EditorGUI.EndDisabledGroup();

                    if (ICEEditorLayout.ListDeleteButton <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, _collision, "Removes the selected collision rule"))
                    {
                        if (_control.Creature.Environment.CollisionHandler.Collisions.Count == 0)
                        {
                            _control.Creature.Environment.CollisionHandler.Enabled = false;
                        }
                        return;
                    }

                    GUILayout.Space(5);
                    if (ICEEditorLayout.ListUpDownButtons <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, i))
                    {
                        return;
                    }

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

                    ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE);
                    // IMPACT RULE HEADER END

                    // IMPACT RULE CONTENT BEGIN
                    if (_collision.Foldout)
                    {
                        EditorGUI.BeginDisabledGroup(_collision.Enabled == false);
                        ICEEditorLayout.BeginHorizontal();
                        _collision.Name = ICEEditorLayout.Text("Name", "", _collision.Name);
                        if (ICEEditorLayout.ResetButtonSmall())
                        {
                            _collision.Name = "";
                        }
                        ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_NAME);

                        EditorGUILayout.Separator();
                        ICEEditorLayout.BeginHorizontal();
                        ICEEditorLayout.Label("Conditions", true);

                        _collision.UseTag      = ICEEditorLayout.CheckButtonMiddle("TAG", "", _collision.UseTag);
                        _collision.UseLayer    = ICEEditorLayout.CheckButtonMiddle("LAYER", "", _collision.UseLayer);
                        _collision.UseBodyPart = ICEEditorLayout.CheckButtonMiddle("COLLIDER", "", _collision.UseBodyPart);
                        ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_CONDITIONS);
                        EditorGUI.indentLevel++;

                        if (_collision.UseLayer)
                        {
                            _collision.Layer = ICEEditorLayout.Layer("Layer", "Desired collision layer", _collision.Layer, Info.ENVIROMENT_COLLISION_RULE_LAYER);
                        }

                        if (_collision.UseTag)
                        {
                            _collision.Tag = ICEEditorLayout.Tag("Tag", "Desired collision tag", _collision.Tag, Info.ENVIROMENT_COLLISION_RULE_TAG);
                        }

                        if (_collision.UseBodyPart)
                        {
                            _collision.BodyPart = ICEEditorLayout.ColliderPopup(_control.gameObject, "Body Part", "Desired body part", _collision.BodyPart, Info.ENVIROMENT_COLLISION_RULE_BODYPART);
                        }

                        EditorGUI.indentLevel--;

                        EditorGUILayout.Separator();
                        ICEEditorLayout.Label("Procedures", true, Info.ENVIROMENT_COLLISION_RULE_PROCEDURES);
                        EditorGUI.indentLevel++;
                        _collision.UseBehaviourModeKey = ICEEditorLayout.Toggle("Behaviour", "", _collision.UseBehaviourModeKey, Info.ENVIROMENT_COLLISION_BEHAVIOUR);
                        if (_collision.UseBehaviourModeKey)
                        {
                            EditorGUI.indentLevel++;
                            _collision.BehaviourModeKey = BehaviourEditor.BehaviourSelect(_control, "Behaviour", "Reaction to this impact", _collision.BehaviourModeKey, "COLLISION_" + _collision.Name.ToUpper(), Info.ENVIROMENT_COLLISION_BEHAVIOUR);
                            EditorGUI.indentLevel--;
                        }

                        EditorHeaderType _header = EditorHeaderType.TOGGLE;
                        CreatureObjectEditor.DrawInfluenceObject(_collision.Influences, _header, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.ENVIROMENT_COLLISION_INFLUENCES);
                        //CreatureObjectEditor.DrawAudioObject( _collision.Audio, _header, Info.ENVIROMENT_COLLISION_AUDIO );
                        //CreatureObjectEditor.DrawEffectObject( _control, _collision.Effect, _header, Info.ENVIROMENT_COLLISION_EFFECT );


                        //_impact.ForceInteraction = EditorGUILayout.Toggle("Force Interaction", _impact.ForceInteraction );
                        EditorGUI.indentLevel--;
                        EditorGUILayout.Separator();


                        EditorGUI.EndDisabledGroup();
                        ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
                    }
                    // IMPACT RULE CONTENT END
                }
            }

            ICEEditorLayout.DrawListAddLine <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, new CollisionDataObject(), false, "Add Collision Rule");

            WorldObjectEditor.EndObjectContent();
            // CONTENT END
        }