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(); }
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 InteractorRuleObject DrawInteractorRuleOffset( ICECreatureControl _control,InteractorObject _interactor, InteractorRuleObject _rule ) * { * TargetObject _target = _rule as TargetObject;//new TargetObject( TargetType.INTERACTOR ); * _target.TargetGameObject = _interactor.TargetGameObject;// m_creature_register.GetTargetByName( _interactor.TargetName ); * _target.TargetTag = _interactor.TargetTag; * _target.TargetName = _interactor.TargetName; * * _rule.OverrideTargetMovePosition = EditorSharedTools.DrawTargetObjectBlind( _target, _rule.OverrideTargetMovePosition ); * if( _rule.OverrideTargetMovePosition ) * EditorSharedTools.DrawTargetMoveSettings( _control.gameObject, _target); * * return _rule; * } */ private static bool DrawInteractorRule(ICECreatureControl _control, InteractorObject _interactor, int _index) { InteractorRuleObject _rule = _interactor.Rules[_index]; ICEEditorLayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(_rule.Enabled == false); _rule.Foldout = ICEEditorLayout.Foldout(_rule.Foldout, " Act #" + (_index + 2) + " - " + _rule.Behaviour.BehaviourTitle()); if (ICEEditorLayout.CopyButtonSmall("Creates a copy of the selected interactor rule")) { _interactor.Rules.Insert(_index, new InteractorRuleObject(_rule, true)); } if (ICEEditorLayout.ResetButtonSmall("Resets the selected interactor rule")) { _rule.Copy(new InteractorRuleObject()); } EditorGUI.EndDisabledGroup(); GUILayout.Space(5); if (ICEEditorLayout.ListDeleteButton <InteractorRuleObject>(_interactor.Rules, _rule)) { return(true); } GUILayout.Space(5); if (ICEEditorLayout.ListUpDownButtons <InteractorRuleObject>(_interactor.Rules, _interactor.Rules.IndexOf(_rule))) { return(true); } GUILayout.Space(5); _rule.Enabled = ICEEditorLayout.EnableButton("Enables/disables the selected rule", _rule.Enabled); ICEEditorLayout.PriorityButton(_rule.SelectionPriority); ICEEditorLayout.EndHorizontal(ref _rule.ShowInfoText, ref _rule.InfoText, Info.INTERACTION_INTERACTOR_RULE); if (_rule.Foldout) { EditorGUI.BeginDisabledGroup(_rule.Enabled == false); if (!Application.isPlaying) { _rule.OverrideTargetGameObject(_interactor.TargetGameObject); } _rule.Selectors.CanUseDefaultPriority = true; if (_rule.Selectors.UseDefaultPriority) { _rule.Selectors.Priority = _interactor.Selectors.Priority + _index + 1; } TargetEditor.DrawTargetObjectBlind(_rule as TargetObject, "", ""); TargetEditor.DrawTargetContent(_control, _rule as TargetObject, true, "IACT_" + _interactor.TargetName.ToUpper() + "_R" + (_index + 2)); //TargetEditor.DrawTargetBehaviour( _control, _rule as TargetObject ); /* * // BEHAVIOUR * string _auto_key = _interactor.TargetName + "_action_" + _index; * _rule.BehaviourModeKey = BehaviourEditor.BehaviourSelect( _control, "Behaviour", "Action behaviour for this interaction rule", _rule.BehaviourModeKey, _auto_key ); */ EditorGUILayout.Separator(); EditorGUI.EndDisabledGroup(); } return(false); }
private static bool DrawInteractor(ICECreatureControl _control, InteractionObject _interaction_object, int _index) { ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel); InteractorObject _interactor = _interaction_object.Interactors[_index]; // INTERACTOR TITLE BEGIN string _title = "Interactor '" + _interactor.TargetTitle + "'"; if (_interactor.TargetGameObject == null) { _title += "*"; } if (_interactor.Rules.Count == 0) { _title += " (1 act)"; } else if (_interactor.Rules.Count > 1) { _title += " (" + (_interactor.Rules.Count + 1) + " acts)"; } // INTERACTOR TITLE END // HEADER BEGIN ICEEditorLayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(_interactor.Enabled == false); _interactor.InteractorFoldout = EditorGUILayout.Foldout(_interactor.InteractorFoldout, _title, ICEEditorStyle.Foldout); if (ICEEditorLayout.SaveButtonSmall("Saves selected interactor to file")) { CreatureEditorIO.SaveInteractorToFile(_interactor, _interactor.TargetName); } if (ICEEditorLayout.LoadButtonSmall("Replaces selected interactor settings")) { _interactor.Copy(CreatureEditorIO.LoadInteractorFromFile(new InteractorObject())); } if (ICEEditorLayout.CopyButtonSmall("Creates a copy of the selected interactor")) { _control.Creature.Interaction.Interactors.Add(new InteractorObject(_interactor)); } if (ICEEditorLayout.ResetButtonSmall("Resets the selected interactor settings")) { _interactor.Copy(new InteractorObject()); } EditorGUI.EndDisabledGroup(); GUILayout.Space(5); if (ICEEditorLayout.ListDeleteButton <InteractorObject>(_interaction_object.Interactors, _interactor, "Removes selected interactor")) { return(true); } GUILayout.Space(5); if (ICEEditorLayout.ListUpDownButtons <InteractorObject>(_interaction_object.Interactors, _index)) { return(true); } int _res_foldout = ICEEditorLayout.ListFoldoutButtons(_interactor.Rules); if (_res_foldout == 0 || _res_foldout == 1) { _interactor.Foldout = (_res_foldout == 1 ? true : _res_foldout == 0 ? false : _interactor.Foldout); } GUILayout.Space(5); _interactor.Enabled = ICEEditorLayout.EnableButton(_interactor.Enabled); ICEEditorLayout.PriorityButton(_interactor.AveragePriority, "Average Priority"); ICEEditorLayout.EndHorizontal(ref _interactor.ShowInteractorInfoText, ref _interactor.InteractorInfoText, Info.INTERACTION_INTERACTOR); // HEADER END if (!_interactor.InteractorFoldout) { return(false); } EditorGUI.BeginDisabledGroup(_interactor.Enabled == false); ICEEditorLayout.BeginHorizontal(); _interactor.Foldout = ICEEditorLayout.Foldout(_interactor.Foldout, " Act #1 - " + _interactor.Behaviour.BehaviourTitle()); ICEEditorLayout.PriorityButton(_interactor.SelectionPriority); ICEEditorLayout.EndHorizontal(ref _interactor.ShowInfoText, ref _interactor.InfoText, Info.INTERACTION_INTERACTOR_TARGET); if (_interactor.Foldout) { TargetEditor.DrawTargetObject(_control, _interactor, "", ""); TargetEditor.DrawTargetContent(_control, _interactor, true, "IACT_" + _index + "_0"); EditorGUILayout.Separator(); } for (int _behaviour_index = 0; _behaviour_index < _interactor.Rules.Count; _behaviour_index++) { if (DrawInteractorRule(_control, _interactor, _behaviour_index)) { return(true); } } string _tmp_title = "Add Interaction Rule" + (!string.IsNullOrEmpty(_interactor.TargetTitle) ? " for '" + _interactor.TargetTitle + "'" : ""); ICEEditorLayout.DrawListAddLine <InteractorRuleObject>(_interactor.Rules, new InteractorRuleObject(), _tmp_title); EditorGUI.EndDisabledGroup(); return(false); }