From 8722a9920c1f6119bf6e769cba270e63097f8e25 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 23 May 2024 10:08:29 +0800 Subject: + astar project --- .../Core/Misc/PathRequestSettings.cs | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Core/Misc/PathRequestSettings.cs (limited to 'Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Core/Misc/PathRequestSettings.cs') diff --git a/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Core/Misc/PathRequestSettings.cs b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Core/Misc/PathRequestSettings.cs new file mode 100644 index 0000000..420663a --- /dev/null +++ b/Other/AstarPathfindingDemo/Packages/com.arongranberg.astar/Core/Misc/PathRequestSettings.cs @@ -0,0 +1,71 @@ +namespace Pathfinding { + [System.Serializable] + public struct PathRequestSettings { + /// + /// Graphs that this agent can use. + /// This field determines which graphs will be considered when searching for the start and end nodes of a path. + /// It is useful in numerous situations, for example if you want to make one graph for small units and one graph for large units. + /// + /// This is a bitmask so if you for example want to make the agent only use graph index 3 then you can set this to: + /// settings.graphMask = 1 << 3; + /// + /// See: bitmasks (view in online documentation for working links) + /// + /// Note that this field only stores which graph indices that are allowed. This means that if the graphs change their ordering + /// then this mask may no longer be correct. + /// + /// If you know the name of the graph you can use the method: + /// + /// GraphMask mask1 = GraphMask.FromGraphName("My Grid Graph"); + /// GraphMask mask2 = GraphMask.FromGraphName("My Other Grid Graph"); + /// + /// NNConstraint nn = NNConstraint.Walkable; + /// + /// nn.graphMask = mask1 | mask2; + /// + /// // Find the node closest to somePoint which is either in 'My Grid Graph' OR in 'My Other Grid Graph' + /// var info = AstarPath.active.GetNearest(somePoint, nn); + /// + /// + /// See: multiple-agent-types (view in online documentation for working links) + /// + public GraphMask graphMask; + + /// + /// The penalty for each tag. + /// + /// If null, all penalties will be treated as zero. Otherwise, the array should always have a length of exactly 32. + /// + public int[] tagPenalties; + + /// + /// The tags which this agent can traverse. + /// + /// Note: This field is a bitmask. + /// See: bitmasks (view in online documentation for working links) + /// + public int traversableTags; + + /// + /// Filters which nodes the agent can traverse, and can also add penalties to each traversed node. + /// + /// In most common situations, this is left as null (which implies the default traversal provider: ). + /// But if you need custom pathfinding behavior which cannot be done using the , and , then setting an is a great option. + /// It provides you a lot more control over how the pathfinding works. + /// + /// + /// followerEntity.pathfindingSettings.traversalProvider = new MyCustomTraversalProvider(); + /// + /// + /// See: traversal_provider (view in online documentation for working links) + /// + public ITraversalProvider traversalProvider; + + public static PathRequestSettings Default => new PathRequestSettings { + graphMask = GraphMask.everything, + tagPenalties = new int[32], + traversableTags = -1, + traversalProvider = null, + }; + } +} -- cgit v1.1-26-g67d0