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(); }
/// <summary> /// Handles the behaviour settings. /// </summary> public static void Print(ICECreatureControl _control) { if (!_control.Display.ShowBehaviour) { return; } ICEEditorStyle.SplitterByIndent(0); ICEEditorLayout.BeginHorizontal(); _control.Display.FoldoutBehaviours = ICEEditorLayout.Foldout(_control.Display.FoldoutBehaviours, "Behaviours"); if (ICEEditorLayout.SaveButton("Saves behaviours to file")) { CreatureEditorIO.SaveBehaviourToFile(_control.Creature.Behaviour, _control.gameObject.name); } if (ICEEditorLayout.LoadButton("Loads behavious form file")) { _control.Creature.Behaviour = CreatureEditorIO.LoadBehaviourFromFile(_control.Creature.Behaviour); } if (ICEEditorLayout.ResetButton("Removes all behaviours")) { _control.Creature.Behaviour.Reset(); } ICEEditorLayout.ListFoldoutButtons(_control.Creature.Behaviour.BehaviourModes); ICEEditorLayout.EndHorizontal(Info.BEHAVIOUR); if (_control.Display.FoldoutBehaviours == false) { return; } EditorGUI.indentLevel++; for (int i = 0; i < _control.Creature.Behaviour.BehaviourModes.Count; i++) { if (DrawBehaviourMode(_control, _control.Creature.Behaviour.BehaviourModes[i])) { return; } } EditorGUI.indentLevel--; m_BehaviourKey = (!SystemTools.IsValid(m_BehaviourKey) ? "NEW" : m_BehaviourKey); if (ICEEditorLayout.DrawListAddLine("Add behaviour mode by key", ref m_BehaviourKey)) { _control.Creature.Behaviour.AddBehaviourModeNumbered(m_BehaviourKey); m_BehaviourKey = ""; } }
public static void Print(ICECreatureControl _control) { if (!_control.Display.ShowEnvironment) { return; } string _surfaces = _control.Creature.Environment.SurfaceHandler.Surfaces.Count.ToString(); string _impacts = _control.Creature.Environment.CollisionHandler.Collisions.Count.ToString(); ICEEditorStyle.SplitterByIndent(0); ICEEditorLayout.BeginHorizontal(); _control.Display.FoldoutEnvironment = ICEEditorLayout.Foldout(_control.Display.FoldoutEnvironment, "Environment (" + _surfaces + "/" + _impacts + ")"); if (ICEEditorLayout.SaveButton("")) { CreatureEditorIO.SaveEnvironmentToFile(_control.Creature.Environment, _control.gameObject.name); } if (ICEEditorLayout.LoadButton("")) { _control.Creature.Environment = CreatureEditorIO.LoadEnvironmentFromFile(_control.Creature.Environment); } if (ICEEditorLayout.ResetButton("")) { _control.Creature.Environment.Reset(); } ICEEditorLayout.EndHorizontal(Info.ENVIROMENT); if (!_control.Display.FoldoutEnvironment) { return; } EditorGUILayout.Separator(); EditorGUI.indentLevel++; DrawEnvironmentSurfaceSettings(_control); DrawEnvironmentCollisionSettings(_control); EditorGUI.indentLevel--; EditorGUILayout.Separator(); }
public static void Print(ICECreatureControl _control) { if (!_control.Display.ShowStatus) { return; } ICEEditorStyle.SplitterByIndent(0); ICEEditorLayout.BeginHorizontal(); _control.Display.FoldoutStatus = ICEEditorLayout.Foldout(_control.Display.FoldoutStatus, "Status"); if (ICEEditorLayout.SaveButton()) { CreatureEditorIO.SaveStatusToFile(_control.Creature.Status, _control.gameObject.name); } if (ICEEditorLayout.LoadButton()) { _control.Creature.Status = CreatureEditorIO.LoadStatusFromFile(_control.Creature.Status); } if (ICEEditorLayout.ResetButton()) { _control.Creature.Status.ResetDefaultValues(); } ICEEditorLayout.EndHorizontal(Info.STATUS); if (_control.Display.FoldoutStatus) { EditorGUILayout.Separator(); DrawStatus(_control); DrawStatusBasics(_control); DrawStatusAdvanced(_control); DrawStatusCorpse(_control); DrawStatusSensoria(_control); DrawStatusMemory(_control); DrawStatusInventory(_control); EditorGUILayout.Separator(); } }
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(); }
public static void Print(ICECreatureControl _control) { if (m_creature_register == null) { m_creature_register = ICECreatureRegister.Instance; } if (m_creature_register == null) { return; } if (!_control.Display.ShowInteraction) { return; } ICEEditorStyle.SplitterByIndent(0); ICEEditorLayout.BeginHorizontal(); _control.Display.FoldoutInteraction = ICEEditorLayout.Foldout(_control.Display.FoldoutInteraction, "Interaction"); if (ICEEditorLayout.SaveButton("Saves the complete interaction settings to file")) { CreatureEditorIO.SaveInteractionToFile(_control.Creature.Interaction, _control.gameObject.name); } if (ICEEditorLayout.LoadButton("Loads existing interaction settings form file")) { _control.Creature.Interaction = CreatureEditorIO.LoadInteractionFromFile(_control.Creature.Interaction); } if (ICEEditorLayout.ResetButton("Removes all interaction settings")) { _control.Creature.Interaction.Reset(); } // GUILayout.Space( 5 ); //if( ICEEditorLayout.ListDeleteButton<InteractorObject>( _control.Creature.Interaction.Interactors, _waypoint ) ) // return true; GUILayout.Space(5); InteractorFoldoutButtons(_control.Creature.Interaction.Interactors); ICEEditorLayout.EndHorizontal(Info.INTERACTION); if (!_control.Display.FoldoutInteraction) { return; } EditorGUILayout.Separator(); EditorGUI.indentLevel++; for (int _interactor_index = 0; _interactor_index < _control.Creature.Interaction.Interactors.Count; ++_interactor_index) { if (DrawInteractor(_control, _control.Creature.Interaction, _interactor_index)) { return; } } EditorGUI.indentLevel--; string _tmp_title = "Add Interactor"; ICEEditorLayout.DrawListAddLine <InteractorObject>(_control.Creature.Interaction.Interactors, new InteractorObject(), _tmp_title); }
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); }
public static void Print(ICECreatureControl _control) { string _global_info = ""; //ICEEditorLayout.SetColors( _control.Display.ShowOptions ); if (_control.Display.UseGlobalAll) { _global_info = " - all global"; } else if (_control.Display.UseGlobal) { _global_info = " - global"; } ICEEditorLayout.BeginHorizontal(); EditorGUILayout.LabelField(_control.gameObject.name + " (" + _control.gameObject.GetInstanceID() + ")" + _global_info, ICEEditorStyle.LabelBold); if (ICEEditorLayout.SaveButton("")) { CreatureEditorIO.SaveCreatureToFile(_control.Creature, _control.gameObject.name); } if (ICEEditorLayout.LoadButton("")) { _control.Creature = CreatureEditorIO.LoadCreatureFromFile(_control.Creature); } if (ICEEditorLayout.ResetButton("")) { _control.Creature = new CreatureObject(); } GUILayout.Space(5); _control.Display.UseGlobalAll = ICEEditorLayout.DebugButton("GLOBAL", "Use the current display options for all your creatures", _control.Display.UseGlobalAll); //_control.Display.ShowOptions = ICEEditorLayout.DebugButton( "OPTIONS", "Use colored button to visualize the related functionality." , _control.Display.ShowOptions ); ICEEditorLayout.EndHorizontal(Info.CREATURE_PRESETS); EditorGUILayout.Separator(); if (_control.Display.ShowOptions) { } _control.UseDebug = _control.Display.ShowDebug; // TARGET DEFAULTS ICECreatureEntityEditor.DrawEntitySettings(_control); EditorGUILayout.Separator(); _control.Display.ShowDebug = _control.UseDebug; ICEEditorLayout.BeginHorizontal(); string[] _tabs = new string[] { "ESSENTIALS", "STATUS", "MISSIONS", "INTERACTION", "ENVIRONMENT", "BEHAVIOURS" }; int _tab_index = 0; if (_control.Display.ShowEssentials) { _tab_index = 0; } else if (_control.Display.ShowStatus) { _tab_index = 1; } else if (_control.Display.ShowMissions) { _tab_index = 2; } else if (_control.Display.ShowInteraction) { _tab_index = 3; } else if (_control.Display.ShowEnvironment) { _tab_index = 4; } else if (_control.Display.ShowBehaviour) { _tab_index = 5; } _tab_index = GUILayout.SelectionGrid(_tab_index, _tabs, 3); _control.Display.ShowEssentials = (_tab_index == 0 ?true:false); _control.Display.ShowStatus = (_tab_index == 1 ?true:false); _control.Display.ShowMissions = (_tab_index == 2 ?true:false); _control.Display.ShowInteraction = (_tab_index == 3 ?true:false); _control.Display.ShowEnvironment = (_tab_index == 4 ?true:false); _control.Display.ShowBehaviour = (_tab_index == 5 ?true:false); ICEEditorLayout.EndHorizontal(); 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 }
/// <summary> /// Draws a behaviour mode. /// </summary> /// <param name="_mode">_mode.</param> /// <param name="_index">_index.</param> public static bool DrawBehaviourMode(ICECreatureControl _control, BehaviourModeObject _mode, bool _editor = false) { if (_mode == null) { return(false); } int _indent = EditorGUI.indentLevel; if (_editor) { EditorGUILayout.Separator(); _mode.Foldout = true; EditorGUI.indentLevel = 1; } else { ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel); } string _title = _mode.Key + " (" + _mode.Rules.Count + (_mode.Rules.Count == 1?" Rule)":" Rules)"); ICEEditorLayout.BeginHorizontal(); if (_editor) { EditorGUILayout.PrefixLabel(_title, "Button", EditorStyles.boldLabel); } else { _mode.Foldout = ICEEditorLayout.Foldout(_mode.Foldout, _title); } GUILayout.FlexibleSpace(); EditorGUI.BeginDisabledGroup(m_BehaviourRenameMode == _mode); if (ICEEditorLayout.Button("RENAME")) { m_BehaviourRenameKey = _mode.Key; m_BehaviourRenameMode = _mode; } EditorGUI.EndDisabledGroup(); GUILayout.Space(5); if (ICEEditorLayout.SaveButtonSmall("Saves selected behaviour mode to file.")) { CreatureEditorIO.SaveBehaviourModeToFile(_mode, _control.name + "_" + _mode.Key); } if (ICEEditorLayout.LoadButtonSmall("Loads a behaviour mode from file.")) { _mode.Copy(CreatureEditorIO.LoadBehaviourModeFromFile(new BehaviourModeObject())); } if (ICEEditorLayout.CopyButtonSmall("Creates a copy of the selected behaviour mode.")) { _control.Creature.Behaviour.CopyBehaviourMode(_mode); } if (ICEEditorLayout.ResetButtonSmall("Resets the selected behaviour mode.")) { _mode.Copy(new BehaviourModeObject(_mode.Key)); } //EditorGUI.EndDisabledGroup(); GUILayout.Space(5); if (ICEEditorLayout.ListDeleteButton <BehaviourModeObject>(_control.Creature.Behaviour.BehaviourModes, _mode, "Removes selected behaviour mode.")) { return(true); } GUILayout.Space(5); if (ICEEditorLayout.ListUpDownButtons <BehaviourModeObject>(_control.Creature.Behaviour.BehaviourModes, _control.Creature.Behaviour.BehaviourModes.IndexOf(_mode))) { return(true); } EditorGUI.BeginDisabledGroup(_mode.Rules.Count < 2); ICEEditorLayout.ListFoldoutButtonsMini(_mode.Rules); EditorGUI.EndDisabledGroup(); GUILayout.Space(3); ICEEditorLayout.EndHorizontal(ref _mode.ShowInfoText, ref _mode.InfoText, Info.BEHAVIOUR_MODE); RenameBehaviourMode(_control, _mode); //EditorGUILayout.Separator(); if (_mode.Foldout) { DrawBehaviourModeContent(_control, _mode); } if (_editor) { EditorGUI.indentLevel = _indent; } return(false); }