CrowdManager.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // CrowdManager.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho.Navigation
  18. {
  19. /// <summary>
  20. /// Crowd manager scene component. Should be added only to the root scene node.
  21. /// </summary>
  22. public unsafe partial class CrowdManager : Component
  23. {
  24. unsafe partial void OnCrowdManagerCreated ();
  25. [Preserve]
  26. public CrowdManager (IntPtr handle) : base (handle)
  27. {
  28. OnCrowdManagerCreated ();
  29. }
  30. [Preserve]
  31. protected CrowdManager (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnCrowdManagerCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int CrowdManager_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (CrowdManager_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr CrowdManager_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (CrowdManager_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int CrowdManager_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(CrowdManager));
  54. return new StringHash (CrowdManager_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr CrowdManager_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(CrowdManager));
  61. return Marshal.PtrToStringAnsi (CrowdManager_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public CrowdManager () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr CrowdManager_CrowdManager (IntPtr context);
  69. [Preserve]
  70. public CrowdManager (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(CrowdManager));
  73. handle = CrowdManager_CrowdManager ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnCrowdManagerCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void CrowdManager_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(CrowdManager));
  85. CrowdManager_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void CrowdManager_ApplyAttributes (IntPtr handle);
  89. /// <summary>
  90. /// Apply attribute changes that can not be applied immediately. Called after scene load or a network update.
  91. /// </summary>
  92. public override void ApplyAttributes ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. CrowdManager_ApplyAttributes (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void CrowdManager_DrawDebugGeometry (IntPtr handle, IntPtr debug, bool depthTest);
  99. /// <summary>
  100. /// Draw the agents' pathing debug data.
  101. /// </summary>
  102. public override void DrawDebugGeometry (DebugRenderer debug, bool depthTest)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. CrowdManager_DrawDebugGeometry (handle, (object)debug == null ? IntPtr.Zero : debug.Handle, depthTest);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern void CrowdManager_DrawDebugGeometry0 (IntPtr handle, bool depthTest);
  109. /// <summary>
  110. /// Add debug geometry to the debug renderer.
  111. /// </summary>
  112. public void DrawDebugGeometry (bool depthTest)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. CrowdManager_DrawDebugGeometry0 (handle, depthTest);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern void CrowdManager_SetCrowdTarget (IntPtr handle, ref Urho.Vector3 position, IntPtr node);
  119. /// <summary>
  120. /// Set the crowd target position. The target position is set to all crowd agents found in the specified node. Defaulted to scene node.
  121. /// </summary>
  122. public void SetCrowdTarget (Urho.Vector3 position, Node node = null)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. CrowdManager_SetCrowdTarget (handle, ref position, (object)node == null ? IntPtr.Zero : node.Handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void CrowdManager_SetCrowdVelocity (IntPtr handle, ref Urho.Vector3 velocity, IntPtr node);
  129. /// <summary>
  130. /// Set the crowd move velocity. The move velocity is applied to all crowd agents found in the specified node. Defaulted to scene node.
  131. /// </summary>
  132. public void SetCrowdVelocity (Urho.Vector3 velocity, Node node = null)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. CrowdManager_SetCrowdVelocity (handle, ref velocity, (object)node == null ? IntPtr.Zero : node.Handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void CrowdManager_ResetCrowdTarget (IntPtr handle, IntPtr node);
  139. /// <summary>
  140. /// Reset any crowd target for all crowd agents found in the specified node. Defaulted to scene node.
  141. /// </summary>
  142. public void ResetCrowdTarget (Node node = null)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. CrowdManager_ResetCrowdTarget (handle, (object)node == null ? IntPtr.Zero : node.Handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void CrowdManager_SetMaxAgents (IntPtr handle, uint maxAgents);
  149. /// <summary>
  150. /// Set the maximum number of agents.
  151. /// </summary>
  152. private void SetMaxAgents (uint maxAgents)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. CrowdManager_SetMaxAgents (handle, maxAgents);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void CrowdManager_SetMaxAgentRadius (IntPtr handle, float maxAgentRadius);
  159. /// <summary>
  160. /// Set the maximum radius of any agent.
  161. /// </summary>
  162. private void SetMaxAgentRadius (float maxAgentRadius)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. CrowdManager_SetMaxAgentRadius (handle, maxAgentRadius);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void CrowdManager_SetNavigationMesh (IntPtr handle, IntPtr navMesh);
  169. /// <summary>
  170. /// Assigns the navigation mesh for the crowd.
  171. /// </summary>
  172. private void SetNavigationMesh (NavigationMesh navMesh)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. CrowdManager_SetNavigationMesh (handle, (object)navMesh == null ? IntPtr.Zero : navMesh.Handle);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void CrowdManager_SetIncludeFlags (IntPtr handle, uint queryFilterType, ushort flags);
  179. /// <summary>
  180. /// Set the include flags for the specified query filter type.
  181. /// </summary>
  182. public void SetIncludeFlags (uint queryFilterType, ushort flags)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. CrowdManager_SetIncludeFlags (handle, queryFilterType, flags);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void CrowdManager_SetExcludeFlags (IntPtr handle, uint queryFilterType, ushort flags);
  189. /// <summary>
  190. /// Set the exclude flags for the specified query filter type.
  191. /// </summary>
  192. public void SetExcludeFlags (uint queryFilterType, ushort flags)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. CrowdManager_SetExcludeFlags (handle, queryFilterType, flags);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void CrowdManager_SetAreaCost (IntPtr handle, uint queryFilterType, uint areaID, float cost);
  199. /// <summary>
  200. /// Set the cost of an area for the specified query filter type.
  201. /// </summary>
  202. public void SetAreaCost (uint queryFilterType, uint areaID, float cost)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. CrowdManager_SetAreaCost (handle, queryFilterType, areaID, cost);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void CrowdManager_SetObstacleAvoidanceParams (IntPtr handle, uint obstacleAvoidanceType, ref CrowdObstacleAvoidanceParams @params);
  209. /// <summary>
  210. /// Set the params for the specified obstacle avoidance type.
  211. /// </summary>
  212. public void SetObstacleAvoidanceParams (uint obstacleAvoidanceType, CrowdObstacleAvoidanceParams @params)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. CrowdManager_SetObstacleAvoidanceParams (handle, obstacleAvoidanceType, ref @params);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern Vector3 CrowdManager_FindNearestPoint (IntPtr handle, ref Urho.Vector3 point, int queryFilterType, uint* nearestRef);
  219. /// <summary>
  220. /// Find the nearest point on the navigation mesh to a given point using the crowd initialized query extent (based on maxAgentRadius) and the specified query filter type.
  221. /// </summary>
  222. public Vector3 FindNearestPoint (Urho.Vector3 point, int queryFilterType, uint* nearestRef = null)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return CrowdManager_FindNearestPoint (handle, ref point, queryFilterType, nearestRef);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern Vector3 CrowdManager_MoveAlongSurface (IntPtr handle, ref Urho.Vector3 start, ref Urho.Vector3 end, int queryFilterType, int maxVisited);
  229. /// <summary>
  230. /// Try to move along the surface from one point to another using the crowd initialized query extent (based on maxAgentRadius) and the specified query filter type.
  231. /// </summary>
  232. public Vector3 MoveAlongSurface (Urho.Vector3 start, Urho.Vector3 end, int queryFilterType, int maxVisited = 3)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return CrowdManager_MoveAlongSurface (handle, ref start, ref end, queryFilterType, maxVisited);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern Vector3 CrowdManager_GetRandomPoint (IntPtr handle, int queryFilterType, uint* randomRef);
  239. /// <summary>
  240. /// Return a random point on the navigation mesh using the crowd initialized query extent (based on maxAgentRadius) and the specified query filter type.
  241. /// </summary>
  242. public Vector3 GetRandomPoint (int queryFilterType, uint* randomRef = null)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return CrowdManager_GetRandomPoint (handle, queryFilterType, randomRef);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern Vector3 CrowdManager_GetRandomPointInCircle (IntPtr handle, ref Urho.Vector3 center, float radius, int queryFilterType, uint* randomRef);
  249. /// <summary>
  250. /// Return a random point on the navigation mesh within a circle using the crowd initialized query extent (based on maxAgentRadius) and the specified query filter type. The circle radius is only a guideline and in practice the returned point may be further away.
  251. /// </summary>
  252. public Vector3 GetRandomPointInCircle (Urho.Vector3 center, float radius, int queryFilterType, uint* randomRef = null)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. return CrowdManager_GetRandomPointInCircle (handle, ref center, radius, queryFilterType, randomRef);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern float CrowdManager_GetDistanceToWall (IntPtr handle, ref Urho.Vector3 point, float radius, int queryFilterType, Vector3* hitPos, Vector3* hitNormal);
  259. /// <summary>
  260. /// Return distance to wall from a point using the crowd initialized query extent (based on maxAgentRadius) and the specified query filter type. Maximum search radius must be specified.
  261. /// </summary>
  262. public float GetDistanceToWall (Urho.Vector3 point, float radius, int queryFilterType, Vector3* hitPos = null, Vector3* hitNormal = null)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. return CrowdManager_GetDistanceToWall (handle, ref point, radius, queryFilterType, hitPos, hitNormal);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern Vector3 CrowdManager_Raycast (IntPtr handle, ref Urho.Vector3 start, ref Urho.Vector3 end, int queryFilterType, Vector3* hitNormal);
  269. /// <summary>
  270. /// Perform a walkability raycast on the navigation mesh between start and end using the crowd initialized query extent (based on maxAgentRadius) and the specified query filter type. Return the point where a wall was hit, or the end point if no walls.
  271. /// </summary>
  272. public Vector3 Raycast (Urho.Vector3 start, Urho.Vector3 end, int queryFilterType, Vector3* hitNormal = null)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. return CrowdManager_Raycast (handle, ref start, ref end, queryFilterType, hitNormal);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern uint CrowdManager_GetMaxAgents (IntPtr handle);
  279. /// <summary>
  280. /// Get the maximum number of agents.
  281. /// </summary>
  282. private uint GetMaxAgents ()
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. return CrowdManager_GetMaxAgents (handle);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern float CrowdManager_GetMaxAgentRadius (IntPtr handle);
  289. /// <summary>
  290. /// Get the maximum radius of any agent.
  291. /// </summary>
  292. private float GetMaxAgentRadius ()
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. return CrowdManager_GetMaxAgentRadius (handle);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern IntPtr CrowdManager_GetNavigationMesh (IntPtr handle);
  299. /// <summary>
  300. /// Get the Navigation mesh assigned to the crowd.
  301. /// </summary>
  302. private NavigationMesh GetNavigationMesh ()
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. return Runtime.LookupObject<NavigationMesh> (CrowdManager_GetNavigationMesh (handle));
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern uint CrowdManager_GetNumQueryFilterTypes (IntPtr handle);
  309. /// <summary>
  310. /// Get the number of configured query filter types.
  311. /// </summary>
  312. private uint GetNumQueryFilterTypes ()
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. return CrowdManager_GetNumQueryFilterTypes (handle);
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern uint CrowdManager_GetNumAreas (IntPtr handle, uint queryFilterType);
  319. /// <summary>
  320. /// Get the number of configured area in the specified query filter type.
  321. /// </summary>
  322. public uint GetNumAreas (uint queryFilterType)
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. return CrowdManager_GetNumAreas (handle, queryFilterType);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern ushort CrowdManager_GetIncludeFlags (IntPtr handle, uint queryFilterType);
  329. /// <summary>
  330. /// Get the include flags for the specified query filter type.
  331. /// </summary>
  332. public ushort GetIncludeFlags (uint queryFilterType)
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. return CrowdManager_GetIncludeFlags (handle, queryFilterType);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern ushort CrowdManager_GetExcludeFlags (IntPtr handle, uint queryFilterType);
  339. /// <summary>
  340. /// Get the exclude flags for the specified query filter type.
  341. /// </summary>
  342. public ushort GetExcludeFlags (uint queryFilterType)
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return CrowdManager_GetExcludeFlags (handle, queryFilterType);
  346. }
  347. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  348. internal static extern float CrowdManager_GetAreaCost (IntPtr handle, uint queryFilterType, uint areaID);
  349. /// <summary>
  350. /// Get the cost of an area for the specified query filter type.
  351. /// </summary>
  352. public float GetAreaCost (uint queryFilterType, uint areaID)
  353. {
  354. Runtime.ValidateRefCounted (this);
  355. return CrowdManager_GetAreaCost (handle, queryFilterType, areaID);
  356. }
  357. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  358. internal static extern uint CrowdManager_GetNumObstacleAvoidanceTypes (IntPtr handle);
  359. /// <summary>
  360. /// Get the number of configured obstacle avoidance types.
  361. /// </summary>
  362. private uint GetNumObstacleAvoidanceTypes ()
  363. {
  364. Runtime.ValidateRefCounted (this);
  365. return CrowdManager_GetNumObstacleAvoidanceTypes (handle);
  366. }
  367. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  368. internal static extern CrowdObstacleAvoidanceParams CrowdManager_GetObstacleAvoidanceParams (IntPtr handle, uint obstacleAvoidanceType);
  369. /// <summary>
  370. /// Get the params for the specified obstacle avoidance type.
  371. /// </summary>
  372. public CrowdObstacleAvoidanceParams GetObstacleAvoidanceParams (uint obstacleAvoidanceType)
  373. {
  374. Runtime.ValidateRefCounted (this);
  375. return CrowdManager_GetObstacleAvoidanceParams (handle, obstacleAvoidanceType);
  376. }
  377. public override StringHash Type {
  378. get {
  379. return UrhoGetType ();
  380. }
  381. }
  382. public override string TypeName {
  383. get {
  384. return GetTypeName ();
  385. }
  386. }
  387. [Preserve]
  388. public new static StringHash TypeStatic {
  389. get {
  390. return GetTypeStatic ();
  391. }
  392. }
  393. public new static string TypeNameStatic {
  394. get {
  395. return GetTypeNameStatic ();
  396. }
  397. }
  398. /// <summary>
  399. /// Get the maximum number of agents.
  400. /// Or
  401. /// Set the maximum number of agents.
  402. /// </summary>
  403. public uint MaxAgents {
  404. get {
  405. return GetMaxAgents ();
  406. }
  407. set {
  408. SetMaxAgents (value);
  409. }
  410. }
  411. /// <summary>
  412. /// Get the maximum radius of any agent.
  413. /// Or
  414. /// Set the maximum radius of any agent.
  415. /// </summary>
  416. public float MaxAgentRadius {
  417. get {
  418. return GetMaxAgentRadius ();
  419. }
  420. set {
  421. SetMaxAgentRadius (value);
  422. }
  423. }
  424. /// <summary>
  425. /// Get the Navigation mesh assigned to the crowd.
  426. /// Or
  427. /// Assigns the navigation mesh for the crowd.
  428. /// </summary>
  429. public NavigationMesh NavigationMesh {
  430. get {
  431. return GetNavigationMesh ();
  432. }
  433. set {
  434. SetNavigationMesh (value);
  435. }
  436. }
  437. /// <summary>
  438. /// Get the number of configured query filter types.
  439. /// </summary>
  440. public uint NumQueryFilterTypes {
  441. get {
  442. return GetNumQueryFilterTypes ();
  443. }
  444. }
  445. /// <summary>
  446. /// Get the number of configured obstacle avoidance types.
  447. /// </summary>
  448. public uint NumObstacleAvoidanceTypes {
  449. get {
  450. return GetNumObstacleAvoidanceTypes ();
  451. }
  452. }
  453. }
  454. }