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 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 }
void DrawnAgentUI(SM_SpawnPoint _point) { EditoolsField.Toggle("Unique Agent? ", ref _point.IsMonoAgent); EditoolsLayout.Space(5); if (_point.IsMonoAgent) { EditoolsLayout.Horizontal(true); _point.MonoAgent = (GameObject)EditoolsField.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.HelpBoxInfo($"Add agent to spawn"); EditoolsLayout.Vertical(true); EditoolsButton.Button("Add Agent", Color.cyan, _point.AddAgent); EditoolsButton.ButtonWithConfirm("Clear", 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)EditoolsField.ObjectField(_point.Agents[j], typeof(GameObject), false); EditoolsButton.ButtonWithConfirm("X", Color.red, _point.RemoveAgent, j, "Remove Agent ?", "Remove This Agent ?"); EditoolsLayout.Horizontal(false); } } }
private void ShowPathPointUi(PE_Path _path) { if (_path.PathPoints.Count == 0) { return; } EditoolsLayout.Foldout(ref _path.ShowPoint, $"Show/Hide points {_path.Id}", true); if (_path.ShowPoint) { for (int i = 0; i < _path.PathPoints.Count; i++) { EditoolsLayout.Horizontal(true); _path.PathPoints[i] = EditoolsField.Vector3Field($"Path Point [{i + 1}]", _path.PathPoints[i]); EditoolsButton.ButtonWithConfirm("-", Color.magenta, _path.RemovePoint, i, $"Suppress Point {i + 1} at {_path.PathPoints[i]} ? ", "Are your sure ?"); EditoolsLayout.Horizontal(false); } } EditoolsLayout.Space(1); if (_path.PathPoints.Count > 0) { EditoolsButton.ButtonWithConfirm("Remove All Points", Color.red, _path.ClearPoints, $"Suppress All Points ? ", "Are your sure ?"); } }
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); } }
void DisplayTwoDimentionalArray <T>(T[,] _array) { EditoolsLayout.Horizontal(true); for (int x = 0; x < _array.GetLength(0); x++) { EditoolsLayout.Vertical(true); for (int y = 0; y < _array.GetLength(1); y++) { GUILayout.Label($"[{_array[x,y]}]"); } EditoolsLayout.Vertical(false); } EditoolsLayout.Horizontal(false); }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); EditoolsBox.HelpBoxInfo($"SPAWN TOOL V{version}"); eTarget.TriggerZonePrefab = (SM_SpawnTrigger)EditoolsField.ObjectField(eTarget.TriggerZonePrefab, typeof(SM_SpawnTrigger), false); if (!eTarget.TriggerZonePrefab) { return; } EditoolsLayout.Space(1); DrawnSpawnPointsUI(); SceneView.RepaintAll(); }
private void GlobalSettings() { EditoolsLayout.Horizontal(true); EditoolsBox.HelpBoxInfo($"PATH TOOL V{version}"); EditoolsLayout.Horizontal(false); EditoolsLayout.Horizontal(true); EditoolsButton.ButtonWithConfirm("Remove all Path", Color.red, eTarget.ClearPath, "Clear All Paths ?", $"Are you sure", "Yes", "No", !eTarget.IsEmpty); EditoolsButton.Button("Add Path", Color.green, eTarget.AddPath); EditoolsLayout.Horizontal(false); EditorGUILayout.Space(8); AllPathUI(); DrawnAgentUI(); }
void DrawSpawnPointScene() { for (int i = 0; i < eTarget.SpawnPoints.Count; i++) { SM_SpawnPoint _point = eTarget.SpawnPoints[i]; EditoolsHandle.SetColor(Color.green); EditoolsHandle.DrawWireCube(_point.Position, _point.Size); EditoolsHandle.SetColor(Color.white); EditoolsHandle.PositionHandle(ref _point.Position, Quaternion.identity); EditoolsHandle.ScaleHandle(ref _point.Size, _point.Position, Quaternion.identity, 2); EditoolsLayout.Space(); GetModeScene(_point); } }
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(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditoolsBox.HelpBoxInfo($"Terrain generator build : {eTarget.Version}"); GUILayout.Label("Initials corner value for heightmap generation"); EditoolsField.FloatField("Up Left", ref eTarget.cornerUpLeft); EditoolsField.FloatField("Up Right", ref eTarget.cornerUpRight); EditoolsField.FloatField("Down Left", ref eTarget.cornerDownLeft); EditoolsField.FloatField("Down Right", ref eTarget.cornerDownRight); EditoolsBox.HelpBoxInfo("The map size will be of equation 2 ^ power + 1"); EditoolsField.IntField("power", ref eTarget.power); EditoolsField.IntField("Random range", ref eTarget.randomRange); EditoolsLayout.Space(); GUILayout.Label("Rasterization settings : "); EditoolsField.Toggle("Use min and max value", ref eTarget.useMinMax); EditoolsField.FloatField("Maximum value", ref eTarget.maxValue); EditoolsField.FloatField("Minimum value", ref eTarget.minValue); EditoolsLayout.Space(); /*EditoolsLayout.Space(); * EditoolsButton.Button("Generate Height map", Color.white, GenerateHeightMap); * EditoolsLayout.Space();*/ EditoolsLayout.Space(); EditoolsButton.Button("Create Map", Color.white, CreateMap); EditoolsLayout.Space(); displayArray = EditoolsLayout.Foldout(displayArray, "Heightmap Content"); if (displayArray) { if (eTarget.heightMap == null) { EditoolsBox.HelpBoxError("No valid heightmap"); } else { DisplayTwoDimentionalArray(eTarget.heightMap); } } }
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); } }
void DrawSpawnModeUI(ST_SpawnPoint _point) { EditoolsLayout.Horizontal(true); EditoolsBox.HelpBoxInfo("Add Spawn Mode"); EditoolsLayout.Vertical(true); EditoolsButton.Button("+", Color.green, _point.AddMode); EditoolsButton.ButtonWithConfirm("#", Color.red, _point.ClearModes, "Remove All ?", "Remove All Mode ?", _showCondition: _point.SpawnModes.Count > 0); EditoolsLayout.Vertical(false); EditoolsLayout.Horizontal(false); for (int i = 0; i < _point.SpawnModes.Count; i++) { ST_SpawnMode _mode = _point.SpawnModes[i]; EditoolsLayout.Horizontal(true); _mode.Type = (ST_SpawnType)EditorGUILayout.EnumPopup("Mode Type", _mode.Type); EditoolsButton.ButtonWithConfirm("X", Color.red, _point.RemoveMode, i, "Remove Mode ?", "Remove This Mode ?"); EditoolsLayout.Horizontal(false); DrawModeSettingsUI(_mode); } }
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); } } }