private static void DrawMissionOutpost(ICECreatureControl _control) { if (_control.Display.ShowMissionsHome == false) { return; } ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel); _control.Display.FoldoutMissionOutpost = ICEEditorLayout.Foldout(_control.Display.FoldoutMissionOutpost, "Outpost Mission", Info.MISSION_OUTPOST); if (!_control.Display.FoldoutMissionOutpost) { return; } _control.Creature.Missions.Outpost.Enabled = ICEEditorLayout.Toggle("Mission Enabled", "", _control.Creature.Missions.Outpost.Enabled, Info.MISSION_ENABLED); EditorGUILayout.Separator(); EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Outpost.Enabled == false); _control.Creature.Missions.Outpost.Target = EditorSharedTools.DrawTarget(_control, _control.Creature.Missions.Outpost.Target, "Target", Info.MISSION_OUTPOST_TARGET); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Behaviour", ICEEditorStyle.LabelBold); EditorGUI.indentLevel++; _control.Creature.Missions.Outpost.BehaviourModeTravel = EditorBehaviour.BehaviourSelect(_control, "Travel", "Move behaviour to reach the Outpost", _control.Creature.Missions.Outpost.BehaviourModeTravel, "TRAVEL"); _control.Creature.Missions.Outpost.BehaviourModeRendezvous = EditorBehaviour.BehaviourSelect(_control, "Rendezvous", "Idle behaviour after reaching the current target move position.", _control.Creature.Missions.Outpost.BehaviourModeRendezvous, "RENDEZVOUS"); EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Outpost.Target.TargetRandomRange == 0); _control.Creature.Missions.Outpost.BehaviourModeLeisure = EditorBehaviour.BehaviourSelect(_control, "Leisure", "Randomized leisure activities around the Outpost", _control.Creature.Missions.Outpost.BehaviourModeLeisure, "STANDBY"); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); }
private static void DrawMissionEscort(ICECreatureControl _control) { if (_control.Display.ShowMissionsEscort == false) { return; } ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel); ICEEditorLayout.BeginHorizontal(); _control.Display.FoldoutMissionEscort = ICEEditorLayout.Foldout(_control.Display.FoldoutMissionEscort, "Escort Mission"); if (GUILayout.Button("SAVE", ICEEditorStyle.ButtonMiddle)) { CreatureIO.SaveMissionEscortToFile(_control.Creature.Missions.Escort, _control.gameObject.name); } if (GUILayout.Button("LOAD", ICEEditorStyle.ButtonMiddle)) { _control.Creature.Missions.Escort = CreatureIO.LoadMissionEscortFromFile(_control.Creature.Missions.Escort); } ICEEditorLayout.EndHorizontal(Info.MISSION_ESCORT); if (!_control.Display.FoldoutMissionEscort) { return; } _control.Creature.Missions.Escort.Enabled = ICEEditorLayout.Toggle("Mission Enabled", "", _control.Creature.Missions.Escort.Enabled, Info.MISSION_ENABLED); EditorGUILayout.Separator(); EditorGUI.BeginDisabledGroup(_control.Creature.Missions.Escort.Enabled == false); _control.Creature.Missions.Escort.Target = EditorSharedTools.DrawTarget(_control, _control.Creature.Missions.Escort.Target, "Target", Info.MISSION_ESCORT_TARGET); EditorGUILayout.Separator(); ICEEditorLayout.Label("Behaviour", true, Info.MISSION_ESCORT_BEHAVIOUR); EditorGUI.indentLevel++; _control.Creature.Missions.Escort.BehaviourModeFollow = EditorBehaviour.BehaviourSelect(_control, "Follow", "Move behaviour to follow and reach the leader", _control.Creature.Missions.Escort.BehaviourModeFollow, "FOLLOW"); _control.Creature.Missions.Escort.BehaviourModeEscort = EditorBehaviour.BehaviourSelect(_control, "Escort", "Move behaviour to escort the leader", _control.Creature.Missions.Escort.BehaviourModeEscort, "ESCORT"); _control.Creature.Missions.Escort.BehaviourModeStandby = EditorBehaviour.BehaviourSelect(_control, "Standby", "Idle behaviour if the leader stops", _control.Creature.Missions.Escort.BehaviourModeStandby, "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 = EditorBehaviour.BehaviourSelect(_control, "Idle", "Idle behaviour if the leader breaks for a longer time-span", _control.Creature.Missions.Escort.BehaviourModeIdle, "IDLE"); EditorGUI.indentLevel--; EditorGUILayout.Separator(); EditorGUI.EndDisabledGroup(); }
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 = EditorBehaviour.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:"")); } EditorGUI.BeginDisabledGroup(_duration == 0); rendezvous = EditorBehaviour.BehaviourSelect(_control, "Rendezvous", "Action behaviour after reaching the Stop Distance of the given target move position.", rendezvous, "WP_RENDEZVOUS" + (_index > 0?"_" + _index:"")); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; } }
/// <summary> /// Handles the essential settings. /// </summary> /// <param name="_creature_control">_creature_control.</param> private static void HandleEssentialSettings(ICECreatureControl _control) { _control.Creature.Essentials.Target = EditorSharedTools.DrawTarget(_control, _control.Creature.Essentials.Target, "Home", Info.ESSENTIALS_HOME); EditorGUILayout.Separator(); ICEEditorLayout.Label("Behaviours", true, Info.ESSENTIALS_BEHAVIOURS); EditorGUI.indentLevel++; _control.Creature.Essentials.BehaviourModeTravel = EditorBehaviour.BehaviourSelect(_control, "Travel", "Move behaviour if your creature is on a journey", _control.Creature.Essentials.BehaviourModeTravel, "TRAVEL"); _control.Creature.Essentials.BehaviourModeRendezvous = EditorBehaviour.BehaviourSelect(_control, "Rendezvous", "Idle behaviour after reaching the current target move position.", _control.Creature.Essentials.BehaviourModeRendezvous, "RENDEZVOUS"); EditorGUI.BeginDisabledGroup(_control.Creature.Essentials.Target.TargetRandomRange == 0); _control.Creature.Essentials.BehaviourModeLeisure = EditorBehaviour.BehaviourSelect(_control, "Leisure", "Randomized leisure activities around the home area", _control.Creature.Essentials.BehaviourModeLeisure, "LEISURE"); EditorGUI.EndDisabledGroup(); _control.Creature.Essentials.BehaviourModeDead = EditorBehaviour.BehaviourSelect(_control, "Dead", "Static behaviour if your creature is dead", _control.Creature.Essentials.BehaviourModeDead, "DEAD"); _control.Creature.Essentials.BehaviourModeRespawn = EditorBehaviour.BehaviourSelect(_control, "Respawn", "Idle behaviour after respawn", _control.Creature.Essentials.BehaviourModeRespawn, "RESPAWN"); EditorGUI.indentLevel--; EditorGUILayout.Separator(); }
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 }
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(); }
/// <summary> /// Handles the system settings. /// </summary> /// <param name="_creature_control">_creature_control.</param> private static void HandleSystemSettings(ICECreatureControl _control) { EditorGUILayout.Separator(); ICEEditorLayout.Label("Motion and Pathfinding", true, Info.ESSENTIALS_SYSTEM); EditorGUI.indentLevel++; ICEEditorLayout.BeginHorizontal(); _control.Creature.Move.GroundCheck = (GroundCheckType)ICEEditorLayout.EnumPopup("Ground Check", "Method to handle ground related checks and movements", _control.Creature.Move.GroundCheck); if (_control.Creature.Move.GroundCheck == GroundCheckType.RAYCAST) { if (GUILayout.Button("Add Layer", ICEEditorStyle.ButtonMiddle)) { _control.Creature.Move.GroundLayers.Add("Default"); } } ICEEditorLayout.EndHorizontal(Info.ESSENTIALS_SYSTEM_GROUND_CHECK); if (_control.Creature.Move.GroundCheck == GroundCheckType.RAYCAST) { EditorGUI.indentLevel++; DrawGroundLayers(_control.Creature.Move.GroundLayers); EditorGUI.indentLevel--; } EditorGUILayout.Separator(); if (_control.Creature.Move.GroundOrientation == GroundOrientationType.NONE || _control.Creature.Move.GroundOrientation == GroundOrientationType.BIPED) { _control.Creature.Move.GroundOrientationPlus = false; } ICEEditorLayout.BeginHorizontal(); _control.Creature.Move.GroundOrientation = (GroundOrientationType)ICEEditorLayout.EnumPopup("Ground Orientation", "Vertical direction relative to the ground", _control.Creature.Move.GroundOrientation); EditorGUI.BeginDisabledGroup(_control.Creature.Move.GroundOrientation == GroundOrientationType.NONE || _control.Creature.Move.GroundOrientation == GroundOrientationType.BIPED); _control.Creature.Move.GroundOrientationPlus = ICEEditorLayout.ButtonCheck("PLUS", "", _control.Creature.Move.GroundOrientationPlus, ICEEditorStyle.CMDButtonDouble); EditorGUI.EndDisabledGroup(); ICEEditorLayout.EndHorizontal(Info.ESSENTIALS_SYSTEM_GROUND_ORIENTATION); EditorGUI.BeginDisabledGroup(_control.Creature.Move.GroundOrientation == GroundOrientationType.NONE); EditorGUI.indentLevel++; if (_control.Creature.Move.GroundOrientationPlus) { _control.Creature.Move.Width = ICEEditorLayout.DefaultSlider("Width", "", _control.Creature.Move.Width, 0.01f, 0, 45, (_control.GetComponentInChildren <Renderer>().bounds.size.x / _control.transform.lossyScale.x)); EditorGUI.indentLevel++; _control.Creature.Move.WidthOffset = ICEEditorLayout.DefaultSlider("x-Offset", "", _control.Creature.Move.WidthOffset, 0.01f, -10, 10, 0); EditorGUI.indentLevel--; _control.Creature.Move.Depth = ICEEditorLayout.DefaultSlider("Depth", "", _control.Creature.Move.Depth, 0.01f, 0, 45, (_control.GetComponentInChildren <Renderer>().bounds.size.z / _control.transform.lossyScale.z)); EditorGUI.indentLevel++; _control.Creature.Move.DepthOffset = ICEEditorLayout.DefaultSlider("z-Offset", "", _control.Creature.Move.DepthOffset, 0.01f, -10, 10, 0); EditorGUI.indentLevel--; } _control.Creature.Move.BaseOffset = ICEEditorLayout.DefaultSlider("Base Offset", "", _control.Creature.Move.BaseOffset, 0.01f, -1, 1, 0, Info.ESSENTIALS_SYSTEM_BASE_OFFSET); _control.Creature.Move.UseLeaningTurn = ICEEditorLayout.Toggle("Use Leaning Turn", "Allows to lean into a turn", _control.Creature.Move.UseLeaningTurn, Info.ESSENTIALS_SYSTEM_LEAN_ANGLE); if (_control.Creature.Move.UseLeaningTurn) { Info.Warning(Info.ESSENTIALS_SYSTEM_LEAN_ANGLE_WARNING); } EditorGUI.indentLevel++; EditorGUI.BeginDisabledGroup(_control.Creature.Move.UseLeaningTurn == false); _control.Creature.Move.LeanAngleMultiplier = ICEEditorLayout.DefaultSlider("Lean Angle Multiplier", "Lean angle multiplier", _control.Creature.Move.LeanAngleMultiplier, 0.05f, 0, 1, 0.5f); _control.Creature.Move.MaxLeanAngle = ICEEditorLayout.DefaultSlider("Max. Lean Angle", "Maximum lean angle", _control.Creature.Move.MaxLeanAngle, 0.25f, 0, 45, 35); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); EditorGUILayout.Separator(); _control.Creature.Move.UseInternalGravity = ICEEditorLayout.Toggle("Handle Gravity", "Use internal gravity", _control.Creature.Move.UseInternalGravity, Info.ESSENTIALS_SYSTEM_GRAVITY); EditorGUI.indentLevel++; EditorGUI.BeginDisabledGroup(_control.Creature.Move.UseInternalGravity == false); _control.Creature.Move.Gravity = ICEEditorLayout.AutoSlider("Gravity", "Gravity value (default 9.8)", _control.Creature.Move.Gravity, 0.01f, 0, 100, ref _control.Creature.Move.UseWorldGravity, 9.81f); EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; EditorGUILayout.Separator(); _control.Creature.Move.UseDeadlockHandling = ICEEditorLayout.Toggle("Handle Deadlocks", "Use deadlock handling", _control.Creature.Move.UseDeadlockHandling, Info.DEADLOCK); EditorGUI.indentLevel++; EditorGUI.BeginDisabledGroup(_control.Creature.Move.UseDeadlockHandling == false); _control.Creature.Move.DeadlockMinMoveDistance = ICEEditorLayout.DefaultSlider("Test 1 - Move Distance", "Expected distance the creature should have covered until the defined interval", _control.Creature.Move.DeadlockMinMoveDistance, 0.01f, 0, 5, 0.2f, Info.DEADLOCK_MOVE_DISTANCE); EditorGUI.indentLevel++; _control.Creature.Move.DeadlockMoveInterval = ICEEditorLayout.DefaultSlider("Test Interval (sec.)", "Interval until the next test", _control.Creature.Move.DeadlockMoveInterval, 0.25f, 0, 30, 2, Info.DEADLOCK_MOVE_INTERVAL); _control.Creature.Move.DeadlockMoveMaxCriticalPositions = (int)ICEEditorLayout.DefaultSlider("Max. Critical Positions", "Tolerates the defined number of critical positions before deadlocked will flagged as true.", _control.Creature.Move.DeadlockMoveMaxCriticalPositions, 1, 0, 100, 10, Info.DEADLOCK_MOVE_CRITICAL_POSITION); EditorGUI.indentLevel--; _control.Creature.Move.DeadlockLoopRange = ICEEditorLayout.DefaultSlider("Test 2 - Loop Range", "Expected distance the creature should have covered until the defined interval", _control.Creature.Move.DeadlockLoopRange, 0.01f, 0, 25, _control.Creature.Move.MoveStopDistance, Info.DEADLOCK_LOOP_RANGE); EditorGUI.indentLevel++; _control.Creature.Move.DeadlockLoopInterval = ICEEditorLayout.DefaultSlider("Test Interval (sec.)", "Interval until the next test", _control.Creature.Move.DeadlockLoopInterval, 0.25f, 0, 30, 5, Info.DEADLOCK_LOOP_INTERVAL); _control.Creature.Move.DeadlockLoopMaxCriticalPositions = (int)ICEEditorLayout.DefaultSlider("Max. Critical Positions", "Tolerates the defined number of critical positions before deadlocked will flagged as true.", _control.Creature.Move.DeadlockLoopMaxCriticalPositions, 1, 0, 100, 10, Info.DEADLOCK_LOOP_CRITICAL_POSITION); EditorGUI.indentLevel--; _control.Creature.Move.DeadlockAction = (DeadlockActionType)ICEEditorLayout.EnumPopup("Deadlock Action", "", _control.Creature.Move.DeadlockAction, Info.DEADLOCK_ACTION); if (_control.Creature.Move.DeadlockAction == DeadlockActionType.BEHAVIOUR) { EditorGUI.indentLevel++; _control.Creature.Move.DeadlockBehaviour = EditorBehaviour.BehaviourSelect(_control, "Deadlock Behaviour", "", _control.Creature.Move.DeadlockBehaviour, "DEADLOCK", Info.DEADLOCK_ACTION_BEHAVIOUR); EditorGUI.indentLevel--; } EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; EditorGUILayout.Separator(); EditorGUILayout.Separator(); _control.Creature.Move.FieldOfView = ICEEditorLayout.DefaultSlider("Field Of View", "Field Of View", _control.Creature.Move.FieldOfView * 2, 0.05f, 0, 360, 60, Info.FOV) / 2; EditorGUI.BeginDisabledGroup(_control.Creature.Move.FieldOfView == 0); EditorGUI.indentLevel++; _control.Creature.Move.VisualRange = ICEEditorLayout.DefaultSlider("Visual Range", "Max. Sighting Distance", _control.Creature.Move.VisualRange, 0.25f, 0, 500, 100, Info.FOV_VISUAL_RANGE); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); /* * Info.Help ( Info.ESSENTIALS_SYSTEM_GRADIENT_ANGLE ); * _creature_control.Creature.Move.MaxGradientAngle = ICEEditorLayout.DefaultSlider("Max. Gradient Angle", "Maximum gradient angle for walkable surfaces", _creature_control.Creature.Move.MaxGradientAngle, 1, 0, 90, 45 ); * */ EditorGUILayout.Separator(); EditorGUILayout.LabelField("Default Move"); EditorGUI.indentLevel++; EditorSharedTools.DrawMove(ref _control.Creature.Move.DefaultMove.MoveSegmentLength, ref _control.Creature.Move.DefaultMove.MoveStopDistance, ref _control.Creature.Move.DefaultMove.MoveSegmentVariance, ref _control.Creature.Move.DefaultMove.MoveLateralVariance, ref _control.Creature.Move.DefaultMove.MoveIgnoreLevelDifference, Info.MOVE_DEFAULT); EditorGUI.indentLevel--; EditorGUI.indentLevel--; EditorGUILayout.Separator(); ICEEditorLayout.Label("Additional Components", true, Info.EXTERNAL_COMPONENTS); EditorGUI.indentLevel++; if (_control.GetComponent <NavMeshAgent>() == null) { _control.Creature.Move.UseNavMesh = false; } _control.Creature.Move.UseNavMesh = ICEEditorLayout.Toggle("Use NavMeshAgent", "", _control.Creature.Move.UseNavMesh, Info.EXTERNAL_COMPONENTS_NAVMESHAGENT); if (_control.Creature.Move.UseNavMesh && _control.GetComponent <NavMeshAgent>() == null) { _control.gameObject.AddComponent <NavMeshAgent>(); } ICEEditorLayout.BeginHorizontal(); if (_control.GetComponent <Rigidbody>() == null) { _control.Creature.Move.UseRigidbody = false; } _control.Creature.Move.UseRigidbody = ICEEditorLayout.Toggle("Use Rigidbody", "", _control.Creature.Move.UseRigidbody); if (_control.Creature.Move.UseRigidbody && _control.GetComponent <Rigidbody>() == null) { _control.gameObject.AddComponent <Rigidbody>(); } GUILayout.FlexibleSpace(); if (_control.GetComponent <Rigidbody>() != null) { if (GUILayout.Button("FULL", ICEEditorStyle.ButtonMiddle)) { Rigidbody _rigidbody = _control.GetComponent <Rigidbody>(); _rigidbody.useGravity = true; _rigidbody.isKinematic = false; _rigidbody.angularDrag = 0; _rigidbody.constraints = RigidbodyConstraints.FreezeRotation; } if (GUILayout.Button("SEMI", ICEEditorStyle.ButtonMiddle)) { Rigidbody _rigidbody = _control.GetComponent <Rigidbody>(); _rigidbody.useGravity = false; _rigidbody.isKinematic = true; _rigidbody.angularDrag = 0.05f; _rigidbody.constraints = RigidbodyConstraints.FreezeRotation; } if (GUILayout.Button("OFF", ICEEditorStyle.ButtonMiddle)) { Rigidbody _rigidbody = _control.GetComponent <Rigidbody>(); _rigidbody.useGravity = false; _rigidbody.isKinematic = true; _rigidbody.angularDrag = 0; _rigidbody.constraints = RigidbodyConstraints.FreezeAll; } } ICEEditorLayout.EndHorizontal(Info.EXTERNAL_COMPONENTS_RIGIDBODY); EditorGUI.BeginDisabledGroup(false == false); if (_control.GetComponent <CharacterController>() == null) { _control.Creature.Move.UseCharacterController = false; } _control.Creature.Move.UseCharacterController = EditorGUILayout.Toggle("Use Character Controller", _control.Creature.Move.UseCharacterController); if (_control.Creature.Move.UseCharacterController && _control.GetComponent <CharacterController>() == null) { _control.gameObject.AddComponent <CharacterController>(); } EditorGUI.EndDisabledGroup(); EditorGUI.indentLevel--; EditorGUILayout.Separator(); EditorGUILayout.LabelField("Runtime Behaviour", ICEEditorStyle.LabelBold); EditorGUI.indentLevel++; _control.Creature.UseCoroutine = ICEEditorLayout.Toggle("Use Coroutine", "", _control.Creature.UseCoroutine, Info.RUNTIME_COROUTINE); _control.Creature.DontDestroyOnLoad = ICEEditorLayout.Toggle("Dont Destroy On Load", "", _control.Creature.DontDestroyOnLoad, Info.RUNTIME_DONTDESTROYONLOAD); EditorGUI.indentLevel--; EditorGUILayout.Separator(); }
//******************************************************************************** // OnInspectorGUI //******************************************************************************** public override void OnInspectorGUI() { EditorBehaviour.BehaviourSelectIndex = 0; Info.HelpButtonIndex = 0; if (m_creature_debug != null) { m_creature_control.Display.ShowDebug = m_creature_debug.enabled; } else { m_creature_control.Display.ShowDebug = false; } GUI.changed = false; EditorGUILayout.Separator(); Info.HelpEnabled = m_creature_control.Display.ShowHelp; Info.DescriptionEnabled = m_creature_control.Display.ShowHelpDescription; // COCKPIT EditorRegister.Print(m_creature_control.gameObject.name); EditorDisplay.Print(m_creature_control.Display); EditorInfo.Print(m_creature_control); // ESSENTIALS EditorEssentials.Print(m_creature_control); // STATUS EditorStatus.Print(m_creature_control); // MISSIONS EditorMissions.Print(m_creature_control); // INTERACTION EditorInteraction.Print(m_creature_control); // ENVIRONMENT EditorEnvironment.Print(m_creature_control); //BEHAVIOURS EditorBehaviour.Print(m_creature_control); if (m_creature_control.Display.ShowDebug) { if (m_creature_debug == null) { m_creature_debug = m_creature_control.gameObject.AddComponent <ICECreatureControlDebug>(); } else if (m_creature_debug.enabled == false) { m_creature_debug.enabled = true; } } else if (m_creature_debug != null) { m_creature_debug.enabled = false; /* * DestroyImmediate( m_creature_control.GetComponent<ICECreatureControlDebug>() ); * EditorGUIUtility.ExitGUI();*/ } if (GUI.changed) { EditorUtility.SetDirty(m_creature_control); } }
private static void DrawEnvironmentCollisionSettings(ICECreatureControl _control) { // IMPACT HEADER BEGIN ICEEditorLayout.BeginHorizontal(); _control.Creature.Environment.CollisionHandler.Enabled = ICEEditorLayout.ToggleLeft("Collisions", "", _control.Creature.Environment.CollisionHandler.Enabled, true); if (GUILayout.Button(new GUIContent("ADD", "add a new impact rule"), ICEEditorStyle.ButtonMiddle)) { _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject()); _control.Creature.Environment.CollisionHandler.Enabled = true; } if (GUILayout.Button(new GUIContent("RESET", "removes all impact rules"), ICEEditorStyle.ButtonMiddle)) { _control.Creature.Environment.CollisionHandler.Collisions.Clear(); } ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION); // IMPACT HEADER END if (_control.Creature.Environment.CollisionHandler.Collisions.Count == 0) { _control.Creature.Environment.CollisionHandler.Enabled = false; } // IMPACT CONTENT BEGIN EditorGUI.BeginDisabledGroup(_control.Creature.Environment.CollisionHandler.Enabled == false); EditorGUI.indentLevel++; for (int i = 0; i < _control.Creature.Environment.CollisionHandler.Collisions.Count; i++) { CollisionDataObject _collision = _control.Creature.Environment.CollisionHandler.Collisions[i]; if (_collision != null) { string _title = _collision.Name; if (_title == "") { _title = "Collision Rule #" + (i + 1); if (_collision.TagPriority > 0) { if (_title != "") { _title += " "; } _title += "T:" + _collision.Tag; } if (_collision.LayerPriority > 0) { if (_title != "") { _title += " "; } _title += "L:" + LayerMask.LayerToName(_collision.Layer); } _collision.Name = _title; } // IMPACT RULE HEADER BEGIN ICEEditorLayout.BeginHorizontal(); _collision.Foldout = ICEEditorLayout.Foldout(_collision.Foldout, _collision.Name); _collision.Enabled = ICEEditorLayout.ButtonCheck("ACTIVE", "activates/deactivates the selected collision rule", _collision.Enabled, ICEEditorStyle.ButtonMiddle); if (GUILayout.Button(new GUIContent("REMOVE", "removes the selected collision rule"), ICEEditorStyle.ButtonMiddle)) { _control.Creature.Environment.CollisionHandler.Collisions.Remove(_collision); return; } 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 (GUILayout.Button(new GUIContent("CLR", ""), ICEEditorStyle.CMDButtonDouble)) { _collision.Name = ""; } ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_NAME); EditorGUILayout.Separator(); ICEEditorLayout.Label("Conditions", true, Info.ENVIROMENT_COLLISION_RULE_CONDITIONS); EditorGUI.indentLevel++; _collision.Type = (CollisionConditionType)ICEEditorLayout.EnumPopup("Type", "Collision ", _collision.Type, Info.ENVIROMENT_COLLISION_RULE_TYPE); if (_collision.Type == CollisionConditionType.LAYER) { _collision.TagPriority = 0; } else if (_collision.Type == CollisionConditionType.LAYER) { _collision.LayerPriority = 0; } if (_collision.Type == CollisionConditionType.LAYER || _collision.Type == CollisionConditionType.TAG_AND_LAYER) { _collision.Layer = ICEEditorLayout.Layer("Layer", "Desired collision layer", _collision.Layer, Info.ENVIROMENT_COLLISION_RULE_LAYER); EditorGUI.indentLevel++; _collision.LayerPriority = (int)ICEEditorLayout.DefaultSlider("Priority", "", _collision.LayerPriority, 1, 0, 10, 1, Info.ENVIROMENT_COLLISION_RULE_LAYER_PRIORITY); EditorGUI.indentLevel--; } if (_collision.Type == CollisionConditionType.TAG || _collision.Type == CollisionConditionType.TAG_AND_LAYER) { _collision.Tag = ICEEditorLayout.Tag("Tag", "Desired collision tag", _collision.Tag, Info.ENVIROMENT_COLLISION_RULE_TAG); EditorGUI.indentLevel++; _collision.TagPriority = (int)ICEEditorLayout.DefaultSlider("Priority", "", _collision.TagPriority, 1, 0, 10, 1, Info.ENVIROMENT_COLLISION_RULE_TAG_PRIORITY); EditorGUI.indentLevel--; } EditorGUI.indentLevel--; EditorGUILayout.Separator(); ICEEditorLayout.Label("Procedures", true, Info.ENVIROMENT_COLLISION_RULE_PROCEDURES); EditorGUI.indentLevel++; //_impact.ForceInteraction = EditorGUILayout.Toggle("Force Interaction", _impact.ForceInteraction ); _collision.Influences.Enabled = EditorGUILayout.Toggle("Influences", _collision.Influences.Enabled); _collision.Influences = EditorSharedTools.DrawShareInfluencesContent(_collision.Influences, Info.ENVIROMENT_COLLISION_INFLUENCES); _collision.BehaviourModeKey = EditorBehaviour.BehaviourSelect(_control, "Behaviour", "Reaction to this impact", _collision.BehaviourModeKey, "IMPACT_" + _collision.Tag.ToUpper()); EditorGUI.indentLevel--; EditorGUILayout.Separator(); EditorGUI.EndDisabledGroup(); ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1); } // IMPACT RULE CONTENT END } } EditorGUILayout.Separator(); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); }
private static void DrawInteractor(ICECreatureControl _control, InteractionObject _interaction_object, int _index) { ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel); InteractorObject _interactor_object = _interaction_object.Interactors[_index]; ICEEditorLayout.BeginHorizontal(); _interactor_object.Foldout = EditorGUILayout.Foldout(_interactor_object.Foldout, "Interactor '" + _interactor_object.Name + "' (" + _interactor_object.Rules.Count + " Rules) ", ICEEditorStyle.Foldout); if (GUILayout.Button(new GUIContent("SAVE", "Saves selected interactor to file"), ICEEditorStyle.ButtonMiddle)) { CreatureIO.SaveInteractorToFile(_interactor_object, _interactor_object.Name); } if (GUILayout.Button(new GUIContent("LOAD", "Replaces selected interactor settings"), ICEEditorStyle.ButtonMiddle)) { _control.Creature.Interaction.Interactors.Insert(_index, CreatureIO.LoadInteractorFromFile(new InteractorObject())); _interaction_object.Interactors.Remove(_interactor_object); return; } if (GUILayout.Button(new GUIContent("REMOVE", "Removes selected interactor"), ICEEditorStyle.ButtonMiddle)) { _interaction_object.Interactors.RemoveAt(_index); --_index; return; } ICEEditorLayout.EndHorizontal(Info.INTERACTION_INTERACTOR); if (!_interactor_object.Foldout) { return; } EditorGUILayout.Separator(); _interactor_object.Enabled = ICEEditorLayout.ToggleLeft("Enabled", "", _interactor_object.Enabled, false, Info.INTERACTION_INTERACTOR_ENABLED); EditorGUI.BeginDisabledGroup(_interactor_object.Enabled == false); EditorGUILayout.Separator(); EditorSharedTools.DrawTargetSelectors(_control, _interactor_object.Selectors, TargetType.INTERACTOR, Init.SELECTION_RANGE_MIN, Init.SELECTION_RANGE_MAX); if (_interactor_object.Selectors.SelectionRange == 0) { EditorGUI.indentLevel++; Info.Note("Selection Range adjusted to zero - no regional selection restriction!"); EditorGUI.indentLevel--; } _interactor_object = DrawInteractorOffset(_control, _interactor_object); _interactor_object.BehaviourModeKey = EditorBehaviour.BehaviourSelect(_control, "Behaviour", "Behaviour while sensing this interactor", _interactor_object.BehaviourModeKey, "SENSE"); EditorGUILayout.Separator(); ICEEditorLayout.Label("Additional Rules for meeting '" + _interactor_object.Name + "' creatures.", true); if (_interactor_object.Rules.Count == 0) { Info.Note(Info.INTERACTION_INTERACTOR_NO_RULES); } else { EditorGUILayout.Separator(); for (int _behaviour_index = 0; _behaviour_index < _interactor_object.Rules.Count; _behaviour_index++) { DrawInteractorRule(_control, _interactor_object, _behaviour_index); } } ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1); ICEEditorLayout.BeginHorizontal(); EditorGUILayout.LabelField("Add Interaction Rule for '" + _interactor_object.Name + "'", EditorStyles.boldLabel); if (GUILayout.Button("ADD", ICEEditorStyle.ButtonMiddle)) { _interactor_object.Rules.Add(new InteractorRuleObject("")); } ICEEditorLayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUI.EndDisabledGroup(); }
private static void DrawInteractorRule(ICECreatureControl _control, InteractorObject _interactor, int _index) { InteractorRuleObject _rule = _interactor.Rules[_index]; InteractorRuleObject _prev_rule = null; InteractorRuleObject _next_rule = null; float _rule_max_distance = Init.DEFAULT_MAX_DISTANCE; float _rule_min_distance = 0; if (_interactor.Selectors.SelectionRange >= _rule.Selectors.SelectionRange + Init.SELECTION_RANGE_STEP) { _rule_max_distance = _interactor.Selectors.SelectionRange - Init.SELECTION_RANGE_STEP; } int _prev_index = _index - 1; int _next_index = _index + 1; if (_prev_index >= 0) { _prev_rule = _interactor.Rules[_prev_index]; _rule_max_distance = _prev_rule.Selectors.SelectionRange - Init.SELECTION_RANGE_STEP; } if (_next_index < _interactor.Rules.Count) { _next_rule = _interactor.Rules[_next_index]; _rule_min_distance = _next_rule.Selectors.SelectionRange + Init.SELECTION_RANGE_STEP; } ICEEditorLayout.BeginHorizontal(); _rule.Enabled = ICEEditorLayout.ToggleLeft(" RULE #" + _index + " - " + (_rule.BehaviourModeKey.Trim() != ""?_rule.BehaviourModeKey:"UNDEFINED"), "", _rule.Enabled, true); if (_interactor.Rules.Count > 1) { EditorGUI.BeginDisabledGroup(_index <= 0); if (ICEEditorLayout.ButtonUp()) { InteractorRuleObject _obj = _interactor.Rules[_index]; _interactor.Rules.RemoveAt(_index); float _obj_selection_range = _obj.Selectors.SelectionRange; if (_index - 1 < 0) { _interactor.Rules.Add(_obj); } else { _interactor.Rules.Insert(_index - 1, _obj); } if (_prev_rule != null) { _obj.Selectors.SelectionRange = _prev_rule.Selectors.SelectionRange; _prev_rule.Selectors.SelectionRange = _obj_selection_range; } return; } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(_index >= _interactor.Rules.Count - 1); if (ICEEditorLayout.ButtonDown()) { InteractorRuleObject _obj = _interactor.Rules[_index]; _interactor.Rules.RemoveAt(_index); float _obj_selection_range = _obj.Selectors.SelectionRange; if (_index + 1 > _interactor.Rules.Count) { _interactor.Rules.Insert(0, _obj); } else { _interactor.Rules.Insert(_index + 1, _obj); } if (_next_rule != null) { _obj.Selectors.SelectionRange = _next_rule.Selectors.SelectionRange; _next_rule.Selectors.SelectionRange = _obj_selection_range; } return; } EditorGUI.EndDisabledGroup(); } if (GUILayout.Button("X", ICEEditorStyle.CMDButtonDouble)) { _interactor.Rules.RemoveAt(_index); --_index; } ICEEditorLayout.EndHorizontal(Info.INTERACTION_INTERACTOR_RULE); EditorGUI.BeginDisabledGroup(_rule.Enabled == false); EditorGUI.indentLevel++; _rule.Selectors.CanUseDefaultPriority = true; _rule.Selectors.DefaultPriority = _interactor.Selectors.Priority; EditorSharedTools.DrawTargetSelectors(_control, _rule.Selectors, TargetType.INTERACTOR, _rule_min_distance, _rule_max_distance); EditorGUILayout.Separator(); // TARGET MOVE POSITION _rule.OverrideTargetMovePosition = ICEEditorLayout.ToggleLeft("Override Target Move Specifications", "Overriding the Target Move Specifications", _rule.OverrideTargetMovePosition, false); if (_rule.OverrideTargetMovePosition) { _rule = DrawInteractorRuleOffset(_control, _interactor, _rule); EditorGUI.indentLevel++; EditorGUILayout.Separator(); _rule.BlockRuleUpdateUntilMovePositionReached = ICEEditorLayout.Toggle("Block Next Rule", "Blocking the next rule until the target move position was reached", _rule.BlockRuleUpdateUntilMovePositionReached, Info.INTERACTION_INTERACTOR_RULE_BLOCK); if (_rule.BlockRuleUpdateUntilMovePositionReached) { string _text = "This rule will be active until your creature reached the given move-position, so please make sure, that all potential positions " + "reachable for your creature, otherwise you will provoke a deadlock!"; if (_rule.Selectors.SelectionRange == 0) { _text += "\n\nThe SelectionRange of this rule is adjusted to zero "; } Info.Note(_text); } EditorGUI.indentLevel--; } EditorGUILayout.Separator(); // BEHAVIOUR string _auto_key = _interactor.Name + "_action_" + _index; _rule.BehaviourModeKey = EditorBehaviour.BehaviourSelect(_control, "Behaviour", "Action behaviour for this interaction rule", _rule.BehaviourModeKey, _auto_key); EditorGUILayout.Separator(); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); }
public static void DrawTargetSelectors(ICECreatureControl _control, TargetSelectorsObject _selectors, TargetType _type, float _min_distance, float _max_distance) { string _help = Info.TARGET_SELECTION_CRITERIA; if (_type == TargetType.HOME) { _help = Info.TARGET_SELECTION_CRITERIA + "\n\n" + Info.TARGET_SELECTION_CRITERIA_HOME; } // TARGET SELECTION CRITERIAS if (_type == TargetType.HOME) { _selectors.UseSelectionCriteriaForHome = ICEEditorLayout.Toggle("Target Selection Criteria", "The HOME target should always have the lowest priority, but if you want you could adapt these settings also.", _selectors.UseSelectionCriteriaForHome, _help); } else { ICEEditorLayout.Label("Target Selection Criteria", false); } if (_type == TargetType.HOME && _selectors.UseSelectionCriteriaForHome == false) { _selectors.Priority = 0; _selectors.SelectionRange = 0; _selectors.SelectionAngle = 0; _selectors.UseAdvanced = false; return; } EditorGUI.indentLevel++; // PRIORITY BEGIN ICEEditorLayout.BeginHorizontal(); if (_selectors.CanUseDefaultPriority) { _selectors.Priority = (int)ICEEditorLayout.AutoSlider("Priority", "", _selectors.Priority, 1, 0, 100, ref _selectors.UseDefaultPriority, _selectors.DefaultPriority); } else { _selectors.Priority = (int)ICEEditorLayout.DefaultSlider("Priority", "Priority to select this target!", _selectors.Priority, 1, 0, 100, _selectors.GetDefaultPriorityByType(_type)); } ICEEditorLayout.EndHorizontal(_help); // PRIORITY END /* * if( _selectors.UseAdvanced ) * { * ICEEditorLayout.DrawProgressBar("Dynamic Priority", _selectors.GetPriority( _type ) ); * }*/ string _range_title = "Selection Range"; if (_selectors.SelectionRange == 0) { _range_title += " (infinite)"; } else { _range_title += " (limited)"; } // SELECTION RANGE BEGIN ICEEditorLayout.BeginHorizontal(); _selectors.SelectionRange = ICEEditorLayout.DefaultSlider(_range_title, "If the selection range greater than 0 this target will only select if the creature is within the specified range", _selectors.SelectionRange, Init.SELECTION_RANGE_STEP, _min_distance, _max_distance, _selectors.GetDefaultRangeByType(_type)); if (_selectors.UseFieldOfView) { GUI.backgroundColor = Color.yellow; } if (GUILayout.Button(new GUIContent("FOV", "Field Of View - the target must be visible for the creature"), ICEEditorStyle.CMDButtonDouble)) { _selectors.UseFieldOfView = !_selectors.UseFieldOfView; } GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor; if (_selectors.UseAdvanced) { if (GUILayout.Button(new GUIContent("AND", "Add additional AND conditions"), ICEEditorStyle.CMDButtonDouble)) { _selectors.Selectors.Add(new TargetSelectorObject(ConditionalOperatorType.AND)); } if (GUILayout.Button(new GUIContent("OR", "Add additional OR conditions"), ICEEditorStyle.CMDButtonDouble)) { _selectors.Selectors.Add(new TargetSelectorObject(ConditionalOperatorType.AND)); } //if (GUILayout.Button( new GUIContent( "THEN", "Add optional statements for cases the conditions are complied with or completed within the timescales determined" ) , ICEEditorStyle.CMDButtonDouble ) ) // _selectors.Statements.Add( new TargetSelectorStatementObject() ); if (GUILayout.Button(new GUIContent("RESET", "Removes all groups and conditions"), ICEEditorStyle.CMDButtonDouble)) { _selectors.Selectors.Clear(); } } if (_selectors.UseAdvanced) { GUI.backgroundColor = new Vector4(1, 0.6f, 0.3f, 1); } else { GUI.backgroundColor = Color.green; } if (GUILayout.Button(new GUIContent("ADV", "Use advanced selector settings"), ICEEditorStyle.CMDButtonDouble)) { _selectors.UseAdvanced = !_selectors.UseAdvanced; } GUI.backgroundColor = ICEEditorLayout.DefaultBackgroundColor; ICEEditorLayout.EndHorizontal(); // SELECTION RANGE END EditorGUI.BeginDisabledGroup(_selectors.SelectionRange == 0); EditorGUI.indentLevel++; string _angle_title = "Angular Restriction"; if (_selectors.SelectionAngle == 0 || _selectors.SelectionAngle == 180) { _angle_title += " (full-circle)"; } else if (_selectors.SelectionAngle == 90) { _angle_title += " (semi-circle)"; } else if (_selectors.SelectionAngle == 45) { _angle_title += " (quadrant)"; } else { _angle_title += " (sector)"; } // SELECTION ANGLE BEGIN ICEEditorLayout.BeginHorizontal(); _selectors.SelectionAngle = ICEEditorLayout.DefaultSlider(_angle_title, "", _selectors.SelectionAngle * 2, Init.SELECTION_ANGLE_STEP, Init.SELECTION_ANGLE_MIN, Init.SELECTION_ANGLE_MAX, _selectors.GetDefaultAngleByType(_type)) / 2; if (GUILayout.Button(new GUIContent("90", ""), ICEEditorStyle.CMDButtonDouble)) { _selectors.SelectionAngle = 45; } if (GUILayout.Button(new GUIContent("180", ""), ICEEditorStyle.CMDButtonDouble)) { _selectors.SelectionAngle = 90; } if (GUILayout.Button(new GUIContent("360", ""), ICEEditorStyle.CMDButtonDouble)) { _selectors.SelectionAngle = 180; } ICEEditorLayout.EndHorizontal(); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); // SELECTION ANGLE END if (_selectors.UseAdvanced) { Info.Help(Info.TARGET_SELECTION_CRITERIA_ADVANCED); // SELECTOR GROUPS BEGIN foreach (TargetSelectorObject _selector in _selectors.Selectors) { EditorGUI.indentLevel++; for (int i = 0; i < _selector.Conditions.Count; i++) { if (i > 0) { EditorGUI.indentLevel++; } TargetSelectorConditionObject _condition = _selector.Conditions[i]; string _prefix = _condition.ConditionToString(); string _operator = _condition.OperatorToString(); ICEEditorLayout.BeginHorizontal(); if (_condition.ExpressionType == TargetSelectorExpressionType.NONE) { _condition.ExpressionType = (TargetSelectorExpressionType)ICEEditorLayout.EnumPopup(_prefix, "Adds an additional selector of the defined type", TargetSelectorExpressionType.NONE); } else if (_condition.ExpressionType == TargetSelectorExpressionType.DISTANCE) { _condition.Distance = ICEEditorLayout.Slider(_prefix + " Distance " + _operator, "If the selection range greater than 0 this target will only select if the creature is within the specified range", _condition.Distance, Init.SELECTION_RANGE_STEP, Init.SELECTION_RANGE_MIN, Init.SELECTION_RANGE_MAX); } else if (_condition.ExpressionType == TargetSelectorExpressionType.BEHAVIOR) { _condition.BehaviourModeKey = EditorBehaviour.BehaviourPopup(_control, _prefix + " Behaviour " + _operator, "", _condition.BehaviourModeKey); } else if (_condition.ExpressionType == TargetSelectorExpressionType.POSITION) { _condition.PositionType = (TargetSelectorPositionType)ICEEditorLayout.EnumPopup(_prefix + " Creatures Position " + _operator, "Adds an additional selector of the defined type", _condition.PositionType); } else if (_condition.ExpressionType == TargetSelectorExpressionType.PRECURSOR) { if (_condition.PrecursorType == TargetPrecursorType.TYPE) { _condition.PrecursorTargetType = (TargetType)ICEEditorLayout.EnumPopup(_prefix + " Precursor Type " + _operator, "This target will only select if the active target has the specified type.", _condition.PrecursorTargetType); } else if (_condition.PrecursorType == TargetPrecursorType.TAG) { _condition.PrecursorTargetTag = EditorGUILayout.TagField(_prefix + " Precursor Tag " + _operator, _condition.PrecursorTargetTag); } else if (_condition.PrecursorType == TargetPrecursorType.NAME) { _condition.PrecursorTargetName = DrawTargetPopup(_control, _prefix + " Precursor Name " + _operator, "This target will only select if the active target has the specified name.", _condition.PrecursorTargetName); } if (GUILayout.Button(new GUIContent(_condition.PrecursorType.ToString(), "Select precursor type"), ICEEditorStyle.CMDButtonDouble)) { if (_condition.PrecursorType == TargetPrecursorType.TAG) { _condition.PrecursorType = 0; } else { _condition.PrecursorType++; } } } // STANDARD BUTTONS BEGIN if (GUILayout.Button(new GUIContent(_prefix, "Changes conditional operator"), ICEEditorStyle.CMDButtonDouble)) { if (_condition.ConditionType == ConditionalOperatorType.AND) { _condition.ConditionType = ConditionalOperatorType.OR; } else { _condition.ConditionType = ConditionalOperatorType.AND; } } if (GUILayout.Button(new GUIContent(_operator, "Changes relational operator"), ICEEditorStyle.CMDButtonDouble)) { if (_condition.ExpressionType == TargetSelectorExpressionType.DISTANCE) { if (_condition.Operator == LogicalOperatorType.GREATER_OR_EQUAL) { _condition.Operator = 0; } else { _condition.Operator++; } } else { if (_condition.Operator == LogicalOperatorType.NOT) { _condition.Operator = 0; } else { _condition.Operator++; } } } if (GUILayout.Button(new GUIContent("DEL", "Removes this condition"), ICEEditorStyle.CMDButtonDouble)) { _selector.Conditions.Remove(_condition); return; } // STANDARD BUTTONS END ICEEditorLayout.EndHorizontal(); if (i > 0) { EditorGUI.indentLevel--; } } // SELECTOR STATMENTS BEGIN //if( _selector.Statements.Count > 0 ) // DrawTargetSelectorStatement( _control, _selector.Statements ); // SELECTOR STATMENTS END // SELECTOR ADD BEGIN ICEEditorLayout.BeginHorizontal(); if (_selector.Statements.Count > 0) { DrawTargetSelectorStatementContent(_control, _selector.Statements[0]); } else { ICEEditorLayout.Label(" ", false); } if (GUILayout.Button(new GUIContent("THEN", "Add Statement"), ICEEditorStyle.CMDButtonDouble)) { if (_selector.Statements.Count == 0) { _selector.Statements.Add(new TargetSelectorStatementObject()); } else { _selector.Statements.Clear(); } return; } if (GUILayout.Button(new GUIContent("AND", "Add AND condition"), ICEEditorStyle.CMDButtonDouble)) { _selector.Conditions.Add(new TargetSelectorConditionObject(ConditionalOperatorType.AND)); return; } if (GUILayout.Button(new GUIContent("OR", "Add OR condition"), ICEEditorStyle.CMDButtonDouble)) { _selector.Conditions.Add(new TargetSelectorConditionObject(ConditionalOperatorType.OR)); return; } if (GUILayout.Button(new GUIContent("DEL", "Removes the selected group"), ICEEditorStyle.CMDButtonDouble)) { _selectors.Selectors.Remove(_selector); return; } ICEEditorLayout.EndHorizontal(); // SELECTOR ADD END EditorGUI.indentLevel--; } // SELECTOR GROUPS END // SELECTOR STATMENTS BEGIN //if( _selectors.Statements.Count > 0 ) // DrawTargetSelectorStatement( _control, _selectors.Statements ); // SELECTOR STATMENTS END } EditorGUI.indentLevel--; }