From b115f816b43fa3a49e5a4d4eaf36632751846226 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sat, 29 Jul 2023 10:44:24 +0900 Subject: [PATCH] adding obstacle tool --- src/DotRecast.Recast.Demo/RecastDemo.cs | 1 + src/DotRecast.Recast.Demo/Tools/IRcTool.cs | 5 -- .../Tools/ObstacleTool.cs | 47 +++++++++++++++++++ .../Tools/ObstacleToolImpl.cs | 22 +++++++++ 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 src/DotRecast.Recast.Demo/Tools/ObstacleTool.cs create mode 100644 src/DotRecast.Recast.DemoTool/Tools/ObstacleToolImpl.cs diff --git a/src/DotRecast.Recast.Demo/RecastDemo.cs b/src/DotRecast.Recast.Demo/RecastDemo.cs index c5dade8..7b514ad 100644 --- a/src/DotRecast.Recast.Demo/RecastDemo.cs +++ b/src/DotRecast.Recast.Demo/RecastDemo.cs @@ -383,6 +383,7 @@ public class RecastDemo : IRecastDemoChannel toolset = new RcToolsetView( new TestNavmeshTool(), new TileTool(), + new ObstacleTool(), new OffMeshConnectionTool(), new ConvexVolumeTool(), new CrowdTool(), diff --git a/src/DotRecast.Recast.Demo/Tools/IRcTool.cs b/src/DotRecast.Recast.Demo/Tools/IRcTool.cs index 401f9be..700ca4c 100644 --- a/src/DotRecast.Recast.Demo/Tools/IRcTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/IRcTool.cs @@ -28,14 +28,9 @@ public interface IRcTool { ISampleTool GetTool(); void OnSampleChanged(); - void Layout(); - void HandleClick(RcVec3f s, RcVec3f p, bool shift); - void HandleRender(NavMeshRenderer renderer); - void HandleUpdate(float dt); - void HandleClickRay(RcVec3f start, RcVec3f direction, bool shift); } \ No newline at end of file diff --git a/src/DotRecast.Recast.Demo/Tools/ObstacleTool.cs b/src/DotRecast.Recast.Demo/Tools/ObstacleTool.cs new file mode 100644 index 0000000..5d4b1aa --- /dev/null +++ b/src/DotRecast.Recast.Demo/Tools/ObstacleTool.cs @@ -0,0 +1,47 @@ +using DotRecast.Core; +using DotRecast.Recast.Demo.Draw; +using DotRecast.Recast.DemoTool; +using DotRecast.Recast.DemoTool.Tools; +using Serilog; + +namespace DotRecast.Recast.Demo.Tools; + +public class ObstacleTool : IRcTool +{ + private static readonly ILogger Logger = Log.ForContext(); + private readonly ObstacleToolImpl _impl; + + public ObstacleTool() + { + _impl = new(); + } + + public ISampleTool GetTool() + { + return _impl; + } + + public void OnSampleChanged() + { + } + + public void Layout() + { + } + + public void HandleClick(RcVec3f s, RcVec3f p, bool shift) + { + } + + public void HandleRender(NavMeshRenderer renderer) + { + } + + public void HandleUpdate(float dt) + { + } + + public void HandleClickRay(RcVec3f start, RcVec3f direction, bool shift) + { + } +} \ No newline at end of file diff --git a/src/DotRecast.Recast.DemoTool/Tools/ObstacleToolImpl.cs b/src/DotRecast.Recast.DemoTool/Tools/ObstacleToolImpl.cs new file mode 100644 index 0000000..4b3e819 --- /dev/null +++ b/src/DotRecast.Recast.DemoTool/Tools/ObstacleToolImpl.cs @@ -0,0 +1,22 @@ +namespace DotRecast.Recast.DemoTool.Tools +{ + public class ObstacleToolImpl : ISampleTool + { + private Sample _sample; + + public string GetName() + { + return "Create Temp Obstacles"; + } + + public void SetSample(Sample sample) + { + _sample = sample; + } + + public Sample GetSample() + { + return _sample; + } + } +} \ No newline at end of file