void DrawnAgentUI(ST_SpawnPoint _point) { _point.IsMonoAgent = EditorGUILayout.Toggle("Unique Agent? ", _point.IsMonoAgent); EditoolsLayout.Space(5); if (_point.IsMonoAgent) { EditoolsLayout.Horizontal(true); _point.MonoAgent = (GameObject)EditorGUILayout.ObjectField(_point.MonoAgent, typeof(GameObject), false); EditoolsButton.ButtonWithConfirm("X", Color.red, _point.RemoveAgent, "Remove Agent", "Remove Agent?"); EditoolsLayout.Horizontal(false); } else { EditoolsLayout.Horizontal(true); EditoolsBox.HelpBox($"Add agent to spawn"); EditoolsLayout.Vertical(true); EditoolsButton.Button("Add Agent", Color.cyan, _point.AddAgent); EditoolsButton.ButtonWithConfirm("#", Color.red, _point.ClearAgents, "Clear Agents", "Clear All Agents ?", _showCondition: _point.Agents.Count > 0); EditoolsLayout.Vertical(false); EditoolsLayout.Horizontal(false); for (int j = 0; j < _point.Agents.Count; j++) { EditoolsLayout.Horizontal(true); _point.Agents[j] = (GameObject)EditorGUILayout.ObjectField(_point.Agents[j], typeof(GameObject), false); EditoolsButton.ButtonWithConfirm("X", Color.red, _point.RemoveAgent, j, "Remove Agent ?", "Remove This Agent ?"); EditoolsLayout.Horizontal(false); } } }
void DrawnSpawnPointsUI() { EditoolsLayout.Horizontal(true); EditoolsBox.HelpBoxInfo("Add Spawn Point"); EditoolsLayout.Vertical(true); EditoolsButton.Button("+", Color.green, eTarget.AddPoint); EditoolsButton.ButtonWithConfirm("Clear Points", Color.red, eTarget.Clear, "Remove All ?", "Remove All Point ?", _showCondition: eTarget.SpawnPoints.Count > 0); EditoolsLayout.Vertical(false); EditoolsLayout.Horizontal(false); EditoolsLayout.Space(2); for (int i = 0; i < eTarget.SpawnPoints.Count; i++) { EditoolsLayout.Horizontal(true); EditoolsBox.HelpBox($"SpawnPoint {i+1}"); EditoolsButton.ButtonWithConfirm("X", Color.red, eTarget.Remove, i, "Remove Point ?", "Remove This Point ?"); EditoolsLayout.Horizontal(false); if (i > eTarget.SpawnPoints.Count - 1) { return; } SM_SpawnPoint _point = eTarget.SpawnPoints[i]; EditoolsLayout.Foldout(ref _point.IsVisible, "Show/Hide"); if (!_point.IsVisible) { continue; } EditoolsField.Vector3Field("Position", ref _point.Position); EditoolsField.Vector3Field("Size", ref _point.Size); EditoolsField.Toggle("Use Delay ?", ref _point.UseDelay); if (_point.UseDelay) { _point.SpawnDelay = EditorGUILayout.Slider("Spawn Delay", _point.SpawnDelay, 0, 15); } else { _point.SpawnDelay = 0; } EditoolsField.Toggle("Use Trigger ?", ref _point.UseTrigger); EditoolsLayout.Space(); EditoolsLayout.Space(1); DrawSpawnModeUI(_point); DrawnAgentUI(_point); } }
public override void DrawSettings() { EditoolsLayout.Space(3); EditoolsLayout.Horizontal(true); EditoolsBox.HelpBox($"Path ID : {Id}"); EditoolsField.TextField("", ref Id); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); EditoolsBox.HelpBoxInfo("Line Settings"); EditoolsLayout.Vertical(true); EditoolsButton.ButtonWithConfirm("Remove All Points", Color.red, Path.ClearPoints, $"Suppress All Points ? ", "Are your sure ?", "Yes", "No", Path.PathPoints.Count > 0); EditoolsButton.Button("Add Point", Color.green, Path.AddPoint); EditoolsLayout.Vertical(false); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); EditoolsBox.HelpBox("Path Color"); EditoolsField.ColorField(PathColor, ref PathColor); EditoolsLayout.Horizontal(false); // New Line ShowPathPointUi(Path); EditoolsField.IntSlider("Start at percent ", ref currentPercent, 0, 100); if (GUI.changed) { SceneView.RepaintAll(); } }
private void AllPathUI() { if (!eTarget) { return; } for (int i = 0; i < eTarget.Paths.Count; i++) { UF_PathModeSelector _p = eTarget.Paths[i]; UF_PathMode _pathMethod = _p.Mode; EditoolsLayout.Foldout(ref _pathMethod.ShowPath, $"Show/Hide {_pathMethod.Id}", true); if (!_pathMethod.ShowPath) { continue; } EditoolsBox.HelpBox($"[{i}] {_pathMethod.Id} -> {_pathMethod.PathPoints.Count} total points"); EditoolsLayout.Horizontal(true); EditoolsButton.ButtonWithConfirm("Remove This Path", Color.red, eTarget.RemovePath, i, $"Suppress Path {i + 1} ? ", "Are your sure ?"); UF_PathModeSelector _mode = _p; _mode.Type = (UF_PathType)EditoolsField.EnumPopup("Mode Type", _mode.Type); EditoolsLayout.Horizontal(false); _mode.Mode.DrawSettings(); EditoolsLayout.Space(5); } }
public override void OnInspectorGUI() { EditoolsLayout.Horizontal(true); EditoolsBox.HelpBoxInfo("Agents Settings"); EditoolsLayout.Horizontal(false); EditoolsLayout.Space(2); EditoolsLayout.Horizontal(true); targetSettings.SpeedMove = EditoolsField.FloatField("Move Speed", targetSettings.SpeedMove); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); targetSettings.SpeedRotation = EditoolsField.FloatField("Rotation Speed", targetSettings.SpeedRotation); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); EditoolsField.Toggle("Add LookAt ?", ref targetSettings.UseLookAt); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); if (targetSettings.UseLookAt) { EditoolsBox.HelpBox("LookAt Target"); targetSettings.TargetLookAt = (GameObject)EditoolsField.ObjectField(targetSettings.TargetLookAt, typeof(GameObject), true); } EditoolsLayout.Horizontal(false); EditorUtility.SetDirty(targetSettings); // flush value }
private void UiManager() { EditoolsBox.HelpBox("Path Manager", MessageType.Info); AllPathUI(); EditoolsButton.Button("Add Path", Color.white, eTarget.AddPath); if (eTarget.Paths.Count > 0) { EditoolsButton.ButtonWithConfirm("Remove All Path", Color.red, eTarget.ClearPaths, "Suppress All Paths ? ", "Are your sure ?"); } }
public override void DrawSettings() { if (!IsValid) { return; } EditoolsLayout.Space(3); EditoolsLayout.Horizontal(true); EditoolsBox.HelpBox($"Path ID : {Id}"); EditoolsField.TextField("", ref Id); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); EditoolsBox.HelpBoxInfo("Curve Settings"); EditoolsLayout.Vertical(true); EditoolsButton.ButtonWithConfirm("Reset Curve", Color.red, Curve.ResetCurve, "Reset Curve ?", $"Remove Curve", "Are your sure ?", _showCondition: !Curve.IsEmpty); EditoolsButton.Button("Add Segment", Color.green, Curve.AddSegment); EditoolsLayout.Vertical(false); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); EditoolsBox.HelpBox("Curve Color"); EditoolsField.ColorField(PathColor, ref PathColor); EditoolsLayout.Horizontal(false); EditoolsLayout.Space(2); EditoolsField.IntSlider("Start at percent ", ref Curve.CurrentPercent, 0, 100); EditoolsField.IntSlider("Curve Definition", ref Curve.CurveDefinition, Curve.MinDefinition, Curve.MaxDefinition); EditoolsLayout.Space(2); DisplaySegmentSettings(); if (GUI.changed) { Curve.SetCurve(); SceneView.RepaintAll(); } }
private void ShowPathPointUi(UF_PathLine _path) { if (_path.PathPoints.Count == 0) { return; } EditoolsLayout.Foldout(ref _path.ShowPoint, $"Show/Hide points {Id}", true); if (_path.ShowPoint) { for (int i = 0; i < _path.PathPoints.Count; i++) { EditoolsLayout.Horizontal(true); EditoolsButton.ButtonWithConfirm("-", Color.red, _path.RemovePoint, i, $"Suppress Point {i + 1} at {_path.PathPoints[i]} ? ", "Are your sure ?"); EditoolsBox.HelpBox($"[{i + 1} / {_path.PathPoints.Count}]"); _path.PathPoints[i] = EditoolsField.Vector3Field("", _path.PathPoints[i]); EditoolsLayout.Horizontal(false); } } }
private void AllPathUI() { if (!eTarget) { return; } for (int i = 0; i < eTarget.Paths.Count; i++) { PE_Path _p = eTarget.Paths[i]; EditoolsLayout.Foldout(ref _p.ShowPath, $"Show/Hide {_p.Id}", true); if (!_p.ShowPath) { continue; } EditoolsBox.HelpBox($"[{i}] {_p.Id} -> {_p.PathPoints.Count} total points"); EditoolsLayout.Horizontal(true); EditoolsButton.ButtonWithConfirm("Remove This Path", Color.red, eTarget.RemovePath, i, $"Suppress Path {i + 1} ? ", "Are your sure ?"); EditoolsButton.Button("+", Color.green, _p.AddPoint); EditoolsButton.Button("Editable", _p.IsEditable ? Color.green : Color.grey, SetActiveEdition, _p); EditoolsLayout.Horizontal(false); // New Line EditoolsLayout.Horizontal(true); EditoolsField.TextField(_p.Id, ref _p.Id); EditoolsField.ColorField(_p.PathColor, ref _p.PathColor); EditoolsLayout.Horizontal(false); ShowPathPointUi(_p); EditoolsLayout.Space(5); } }
private void DisplaySegmentSettings() { if (!IsValid || Curve.IsEmpty) { return; } EditoolsLayout.Foldout(ref Curve.DipslaySegments, "Curve Segments"); if (!Curve.DipslaySegments) { return; } for (int i = 0; i < Curve.Anchor.Count; i += 3) { EditoolsLayout.Horizontal(true); EditoolsButton.ButtonWithConfirm("X", Color.red, Curve.RemoveSegment, i, $"Remove {i / 3}", $"Remove {i / 3}", "Are your sure ?"); EditoolsBox.HelpBox($"Segment {i / 3} / {(Curve.Anchor.Count - 1) / 3} "); // todo edit anchor position EditoolsLayout.Horizontal(false); } }
void DrawnAgentUI() { if (!eTarget) { return; } EditoolsLayout.Horizontal(true); EditoolsBox.HelpBoxInfo("Agents Settings"); EditoolsLayout.Vertical(true); EditoolsButton.ButtonWithConfirm("Remove all Agents", Color.red, eTarget.ClearAgents, "Clear All Agents ?", $"Clear All Agents", "Are your sure ?", _showCondition: eTarget.Agents.Count > 0); EditoolsButton.Button("Add Agent", Color.green, eTarget.AddAgent); EditoolsLayout.Vertical(false); EditoolsLayout.Horizontal(false); for (int i = 0; i < eTarget.Agents.Count; i++) { if (eTarget.Agents[i] == null) { return; } UF_PathAgent _agent = eTarget.Agents[i]; EditoolsLayout.Foldout(ref _agent.Show, $"{i + 1} / {eTarget.Agents.Count}"); if (!_agent.Show) { continue; } EditoolsLayout.Horizontal(true); EditoolsBox.HelpBox($"{i + 1} / {eTarget.Agents.Count}"); EditoolsButton.ButtonWithConfirm("-", Color.red, eTarget.RemoveAgent, i, $"Remove Agent {i}", "Are your sure ?"); EditoolsLayout.Horizontal(false); // EditoolsField.IntSlider("Speed Move", ref _agent.SpeedMove, _agent.MinSpeedMove, _agent.MaxSpeedMove); // todo remove // EditoolsField.IntSlider("Speed Rotation", ref _agent.SpeedRotation, _agent.MinSpeedRotation _agent.MaxSpeedRotation); // todo remove EditoolsLayout.Horizontal(true); _agent.AgentToMove = (GameObject)EditoolsField.ObjectField(_agent.AgentToMove, typeof(GameObject), true); // todo input for UF_PAthAgentSettings _agent.AgentSettings = (UF_PathAgentSettings)EditoolsField.ObjectField(_agent.AgentSettings, typeof(UF_PathAgentSettings), false); EditoolsButton.Button("New Settings", Color.white, PathManagerMenu.UF_PathManagerMenu.CreateNewAgentProfile, !_agent.AgentSettings); EditoolsLayout.Horizontal(false); if (eTarget.Paths.Count > 0) { string[] _pathsNames = eTarget.Paths.Select(o => o.Mode.Id).ToArray(); _agent.PathIndex = EditorGUILayout.Popup("Paths target", _agent.PathIndex, _pathsNames); _agent.PathId = _pathsNames[_agent.PathIndex]; } else { EditoolsBox.HelpBox("NO PATH FOUND !", MessageType.Error); } } }