Пример #1
0
        private static void DrawMissionPatrolWaypoint(ICECreatureControl _control, int _index)
        {
            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
            WaypointObject _waypoint = _control.Creature.Missions.Patrol.Waypoints.Waypoints[_index];

            if (_waypoint == null)
            {
                return;
            }

            // HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();
            _waypoint.Enabled = EditorGUILayout.ToggleLeft("Waypoint #" + (int)(_index + 1), _waypoint.Enabled, EditorStyles.boldLabel);
            GUILayout.FlexibleSpace();

            if (ICEEditorLayout.ButtonUp())
            {
                WaypointObject _wp = _control.Creature.Missions.Patrol.Waypoints.Waypoints[_index];
                _control.Creature.Missions.Patrol.Waypoints.Waypoints.RemoveAt(_index);
                if (_index - 1 < 0)
                {
                    _control.Creature.Missions.Patrol.Waypoints.Waypoints.Add(_wp);
                }
                else
                {
                    _control.Creature.Missions.Patrol.Waypoints.Waypoints.Insert(_index - 1, _wp);
                }
                return;
            }

            if (ICEEditorLayout.ButtonDown())
            {
                WaypointObject _wp = _control.Creature.Missions.Patrol.Waypoints.Waypoints[_index];
                _control.Creature.Missions.Patrol.Waypoints.Waypoints.RemoveAt(_index);
                if (_index + 1 > _control.Creature.Missions.Patrol.Waypoints.Waypoints.Count)
                {
                    _control.Creature.Missions.Patrol.Waypoints.Waypoints.Insert(0, _wp);
                }
                else
                {
                    _control.Creature.Missions.Patrol.Waypoints.Waypoints.Insert(_index + 1, _wp);
                }
                return;
            }

            if (ICEEditorLayout.ButtonCloseDouble())
            {
                _control.Creature.Missions.Patrol.Waypoints.Waypoints.RemoveAt(_index);
                --_index;
            }
            ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL_WAYPOINT);
            // HEADER END

            // CONTENT BEGIN
            EditorGUI.BeginDisabledGroup(_waypoint.Enabled == false);
            EditorGUI.indentLevel++;
            _waypoint = (WaypointObject)EditorSharedTools.DrawTarget(_control, (TargetObject)_waypoint, "Target", Info.MISSION_PATROL_TARGET);

            EditorGUILayout.Separator();
            _waypoint.UseCustomBehaviour = ICEEditorLayout.Toggle("Custom Behaviour", "", _waypoint.UseCustomBehaviour, Info.MISSION_PATROL_CUSTOM_BEHAVIOUR);

            EditorGUILayout.Separator();

            if (_waypoint.UseCustomBehaviour)
            {
                EditorGUI.indentLevel++;


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

                EditorSharedTools.DrawInRangeBehaviour(_control,
                                                       ref _waypoint.BehaviourModeLeisure,
                                                       ref _waypoint.BehaviourModeRendezvous,
                                                       ref _waypoint.DurationOfStay,
                                                       ref _waypoint.IsTransitPoint,
                                                       _waypoint.TargetRandomRange,
                                                       (int)(_index + 1));



                /*
                 * EditorGUI.BeginDisabledGroup( _waypoint.IsTransitPoint == true );
                 *
                 *                              _waypoint.BehaviourModeLeisure = EditorBehaviour.BehaviourSelect( m_creature_control, "Leisure", "Leisure activities after reaching this waypoint range", _waypoint.BehaviourModeLeisure, "WP_LEISURE_" + _index );
                 *                              _waypoint.BehaviourModeRendezvous = EditorBehaviour.BehaviourSelect( m_creature_control, "Rendezvous", "Action behaviour after reaching this current target move position", _waypoint.BehaviourModeRendezvous, "WP_RENDEZVOUS_" + _index );
                 *                      EditorGUI.EndDisabledGroup();
                 *
                 *                      _waypoint.DurationOfStay = ICEEditorLayout.DurationSlider( "Duration Of Stay", "Duration of stay", _waypoint.DurationOfStay, Init.DURATION_OF_STAY_STEP, Init.DURATION_OF_STAY_MIN, Init.DURATION_OF_STAY_MAX,Init.DURATION_OF_STAY_DEFAULT, ref _waypoint.IsTransitPoint );
                 *
                 */
                EditorGUI.indentLevel--;

                EditorGUILayout.Separator();
            }

            EditorGUI.indentLevel--;

            EditorGUI.EndDisabledGroup();
            // CONTENT END
        }
Пример #2
0
        private static void DrawMissionPatrol(ICECreatureControl _control)
        {
            if (_control.Display.ShowMissionsPatrol == false)
            {
                return;
            }

            ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel);
            _control.Display.FoldoutMissionPatrol = ICEEditorLayout.Foldout(_control.Display.FoldoutMissionPatrol, "Patrol Mission", Info.MISSION_PATROL);

            if (!_control.Display.FoldoutMissionPatrol)
            {
                return;
            }

            _control.Creature.Missions.Patrol.Enabled = ICEEditorLayout.Toggle("Mission Enabled", "", _control.Creature.Missions.Patrol.Enabled, Info.MISSION_ENABLED);
            EditorGUILayout.Separator();
            EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Patrol.Enabled == false);

            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.ButtonCheck("DESC", "descending order", !_control.Creature.Missions.Patrol.Waypoints.Ascending, ICEEditorStyle.CMDButtonDouble);
            EditorGUI.EndDisabledGroup();
            ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL_ORDER_TYPE);

            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Behaviour", ICEEditorStyle.LabelBold);

            EditorGUI.indentLevel++;
            _control.Creature.Missions.Patrol.BehaviourModeTravel = EditorBehaviour.BehaviourSelect(_control, "Travel", "Default travel behaviour to reach the first waypoint", _control.Creature.Missions.Patrol.BehaviourModeTravel, "WP_TRAVEL");
            _control.Creature.Missions.Patrol.BehaviourModePatrol = EditorBehaviour.BehaviourSelect(_control, "Patrol", "Default patrol behaviour to reach the next waypoint", _control.Creature.Missions.Patrol.BehaviourModePatrol, "WP_PATROL");
            EditorSharedTools.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);

            /*
             *      EditorGUI.BeginDisabledGroup( m_creature_control.Creature.Missions.Patrol.IsTransitPoint == true );
             *              m_creature_control.Creature.Missions.Patrol.BehaviourModeLeisure = EditorBehaviour.BehaviourSelect( m_creature_control, "Leisure", "Leisure activities after reaching this waypoint range", m_creature_control.Creature.Missions.Patrol.BehaviourModeLeisure, "WP_LEISURE" );
             *              m_creature_control.Creature.Missions.Patrol.BehaviourModeRendezvous = EditorBehaviour.BehaviourSelect( m_creature_control, "Rendezvous", "Action behaviour after reaching this current waypoint target position", m_creature_control.Creature.Missions.Patrol.BehaviourModeRendezvous, "WP_RENDEZVOUS" );
             *      EditorGUI.EndDisabledGroup();
             *
             * m_creature_control.Creature.Missions.Patrol.DurationOfStay = ICEEditorLayout.DurationSlider( "Duration Of Stay", "Duration of stay", m_creature_control.Creature.Missions.Patrol.DurationOfStay, Init.DURATION_OF_STAY_STEP, Init.DURATION_OF_STAY_MIN, Init.DURATION_OF_STAY_MAX,Init.DURATION_OF_STAY_DEFAULT, ref m_creature_control.Creature.Missions.Patrol.IsTransitPoint );
             */

            EditorGUI.indentLevel--;

            EditorGUILayout.Separator();
            ICEEditorLayout.Label("Waypoints", true, Info.MISSION_PATROL_WAYPOINTS);
            EditorGUI.indentLevel++;
            ICEEditorLayout.BeginHorizontal();
            _control.Creature.Missions.Patrol.Waypoints.WaypointGroup = (GameObject)EditorGUILayout.ObjectField("Add Waypoint Group", _control.Creature.Missions.Patrol.Waypoints.WaypointGroup, typeof(GameObject), true);
            if (GUILayout.Button("REFRESH", ICEEditorStyle.ButtonLarge))
            {
                _control.Creature.Missions.Patrol.Waypoints.UpdateWaypointGroup();
            }
            ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL_ADD_WAYPOINT_GROUP);
            ICEEditorLayout.BeginHorizontal();
            ICEEditorLayout.Label("Add Single Waypoint", false);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("ADD WAYPOINT", ICEEditorStyle.ButtonLarge))
            {
                _control.Creature.Missions.Patrol.Waypoints.Waypoints.Add(new WaypointObject());
            }
            ICEEditorLayout.EndHorizontal(Info.MISSION_PATROL_ADD_WAYPOINT);
            EditorGUI.indentLevel--;

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

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