DtNode.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
  3. recast4j copyright (c) 2015-2019 Piotr Piastucki piotr@jtilia.org
  4. DotRecast Copyright (c) 2023 Choi Ikpil ikpil@naver.com
  5. This software is provided 'as-is', without any express or implied
  6. warranty. In no event will the authors be held liable for any damages
  7. arising from the use of this software.
  8. Permission is granted to anyone to use this software for any purpose,
  9. including commercial applications, and to alter it and redistribute it
  10. freely, subject to the following restrictions:
  11. 1. The origin of this software must not be misrepresented; you must not
  12. claim that you wrote the original software. If you use this software
  13. in a product, an acknowledgment in the product documentation would be
  14. appreciated but is not required.
  15. 2. Altered source versions must be plainly marked as such, and must not be
  16. misrepresented as being the original software.
  17. 3. This notice may not be removed or altered from any source distribution.
  18. */
  19. using System.Collections.Generic;
  20. using DotRecast.Core;
  21. namespace DotRecast.Detour
  22. {
  23. public class DtNode
  24. {
  25. public const int DT_NODE_OPEN = 0x01;
  26. public const int DT_NODE_CLOSED = 0x02;
  27. /** parent of the node is not adjacent. Found using raycast. */
  28. public const int DT_NODE_PARENT_DETACHED = 0x04;
  29. public readonly int index;
  30. /** Position of the node. */
  31. public RcVec3f pos = new RcVec3f();
  32. /** Cost of reaching the given node. */
  33. public float cost;
  34. /** Total cost of reaching the goal via the given node including heuristics. */
  35. public float total;
  36. /** Index to parent node. */
  37. public int pidx;
  38. /**
  39. * extra state information. A polyRef can have multiple nodes with different extra info. see DT_MAX_STATES_PER_NODE
  40. */
  41. public int state;
  42. /** Node flags. A combination of dtNodeFlags. */
  43. public int flags;
  44. /** Polygon ref the node corresponds to. */
  45. public long id;
  46. /** Shortcut found by raycast. */
  47. public List<long> shortcut;
  48. public DtNode(int index)
  49. {
  50. this.index = index;
  51. }
  52. public override string ToString()
  53. {
  54. return "Node [id=" + id + "]";
  55. }
  56. }
  57. }