From a331b3e8619805bfaaeccc64d4e4e1cfe27d0aa0 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sun, 3 Sep 2023 16:51:41 +0900 Subject: [PATCH] for unity3d --- src/DotRecast.Detour/DtStraightPathOption.cs | 24 +++++++++++++++++++ .../Tools/TestNavmeshSampleTool.cs | 6 ++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 src/DotRecast.Detour/DtStraightPathOption.cs diff --git a/src/DotRecast.Detour/DtStraightPathOption.cs b/src/DotRecast.Detour/DtStraightPathOption.cs new file mode 100644 index 0000000..323b2d7 --- /dev/null +++ b/src/DotRecast.Detour/DtStraightPathOption.cs @@ -0,0 +1,24 @@ +using DotRecast.Core; + +namespace DotRecast.Detour +{ + public class DtStraightPathOption + { + public static readonly DtStraightPathOption None = new DtStraightPathOption(0, "None"); + public static readonly DtStraightPathOption AreaCrossings = new DtStraightPathOption(DtNavMeshQuery.DT_STRAIGHTPATH_AREA_CROSSINGS, "Area"); + public static readonly DtStraightPathOption AllCrossings = new DtStraightPathOption(DtNavMeshQuery.DT_STRAIGHTPATH_ALL_CROSSINGS, "All"); + + public static readonly RcImmutableArray Values = RcImmutableArray.Create( + None, AreaCrossings, AllCrossings + ); + + public readonly int Value; + public readonly string Label; + + private DtStraightPathOption(int value, string label) + { + Value = value; + Label = label; + } + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Tools/TestNavmeshSampleTool.cs b/src/DotRecast.Recast.Demo/Tools/TestNavmeshSampleTool.cs index 133d22e..f45f134 100644 --- a/src/DotRecast.Recast.Demo/Tools/TestNavmeshSampleTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/TestNavmeshSampleTool.cs @@ -126,9 +126,9 @@ public class TestNavmeshSampleTool : ISampleTool { ImGui.Text("Vertices at crossings"); ImGui.Separator(); - ImGui.RadioButton("None", ref _option.straightPathOptions, 0); - ImGui.RadioButton("Area", ref _option.straightPathOptions, DtNavMeshQuery.DT_STRAIGHTPATH_AREA_CROSSINGS); - ImGui.RadioButton("All", ref _option.straightPathOptions, DtNavMeshQuery.DT_STRAIGHTPATH_ALL_CROSSINGS); + ImGui.RadioButton("None", ref _option.straightPathOptions, DtStraightPathOption.None.Value); + ImGui.RadioButton("Area", ref _option.straightPathOptions, DtStraightPathOption.AreaCrossings.Value); + ImGui.RadioButton("All", ref _option.straightPathOptions, DtStraightPathOption.AllCrossings.Value); } if (_option.mode == RcTestNavmeshToolMode.RANDOM_POINTS_IN_CIRCLE)