MiscLegacy.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using UnityEngine;
  2. using Pathfinding.Util;
  3. namespace Pathfinding {
  4. // Obsolete methods in AIPath
  5. public partial class AIPath {
  6. /// <summary>
  7. /// True if the end of the path has been reached.
  8. /// Deprecated: When unifying the interfaces for different movement scripts, this property has been renamed to <see cref="reachedEndOfPath"/>
  9. /// </summary>
  10. [System.Obsolete("When unifying the interfaces for different movement scripts, this property has been renamed to reachedEndOfPath. [AstarUpgradable: 'TargetReached' -> 'reachedEndOfPath']")]
  11. public bool TargetReached { get { return reachedEndOfPath; } }
  12. /// <summary>
  13. /// Rotation speed.
  14. /// Deprecated: This field has been renamed to <see cref="rotationSpeed"/> and is now in degrees per second instead of a damping factor.
  15. /// </summary>
  16. [System.Obsolete("This field has been renamed to #rotationSpeed and is now in degrees per second instead of a damping factor")]
  17. public float turningSpeed { get { return rotationSpeed/90; } set { rotationSpeed = value*90; } }
  18. /// <summary>
  19. /// Maximum speed in world units per second.
  20. /// Deprecated: Use <see cref="maxSpeed"/> instead
  21. /// </summary>
  22. [System.Obsolete("This member has been deprecated. Use 'maxSpeed' instead. [AstarUpgradable: 'speed' -> 'maxSpeed']")]
  23. public float speed { get { return maxSpeed; } set { maxSpeed = value; } }
  24. /// <summary>
  25. /// Direction that the agent wants to move in (excluding physics and local avoidance).
  26. /// Deprecated: Only exists for compatibility reasons. Use <see cref="desiredVelocity"/> or <see cref="steeringTarget"/> instead instead.
  27. /// </summary>
  28. [System.Obsolete("Only exists for compatibility reasons. Use desiredVelocity or steeringTarget instead.")]
  29. public Vector3 targetDirection {
  30. get {
  31. return (steeringTarget - tr.position).normalized;
  32. }
  33. }
  34. /// <summary>
  35. /// Current desired velocity of the agent (excluding physics and local avoidance but it includes gravity).
  36. /// Deprecated: This method no longer calculates the velocity. Use the <see cref="desiredVelocity"/> property instead.
  37. /// </summary>
  38. [System.Obsolete("This method no longer calculates the velocity. Use the desiredVelocity property instead")]
  39. public Vector3 CalculateVelocity (Vector3 position) {
  40. return desiredVelocity;
  41. }
  42. }
  43. // Obsolete methods in RichAI
  44. public partial class RichAI {
  45. /// <summary>
  46. /// Force recalculation of the current path.
  47. /// If there is an ongoing path calculation, it will be canceled (so make sure you leave time for the paths to get calculated before calling this function again).
  48. ///
  49. /// Deprecated: Use <see cref="SearchPath"/> instead
  50. /// </summary>
  51. [System.Obsolete("Use SearchPath instead. [AstarUpgradable: 'UpdatePath' -> 'SearchPath']")]
  52. public void UpdatePath () {
  53. SearchPath();
  54. }
  55. /// <summary>
  56. /// Current velocity of the agent.
  57. /// Includes velocity due to gravity.
  58. /// Deprecated: Use <see cref="velocity"/> instead (lowercase 'v').
  59. /// </summary>
  60. [System.Obsolete("Use velocity instead (lowercase 'v'). [AstarUpgradable: 'Velocity' -> 'velocity']")]
  61. public Vector3 Velocity { get { return velocity; } }
  62. /// <summary>
  63. /// Waypoint that the agent is moving towards.
  64. /// This is either a corner in the path or the end of the path.
  65. /// Deprecated: Use steeringTarget instead.
  66. /// </summary>
  67. [System.Obsolete("Use steeringTarget instead. [AstarUpgradable: 'NextWaypoint' -> 'steeringTarget']")]
  68. public Vector3 NextWaypoint { get { return steeringTarget; } }
  69. /// <summary>
  70. /// \details
  71. /// Deprecated: Use Vector3.Distance(transform.position, ai.steeringTarget) instead.
  72. /// </summary>
  73. [System.Obsolete("Use Vector3.Distance(transform.position, ai.steeringTarget) instead.")]
  74. public float DistanceToNextWaypoint { get { return distanceToSteeringTarget; } }
  75. /// <summary>Search for new paths repeatedly</summary>
  76. [System.Obsolete("Use canSearch instead. [AstarUpgradable: 'repeatedlySearchPaths' -> 'canSearch']")]
  77. public bool repeatedlySearchPaths { get { return canSearch; } set { canSearch = value; } }
  78. /// <summary>
  79. /// True if the end of the path has been reached.
  80. /// Deprecated: When unifying the interfaces for different movement scripts, this property has been renamed to <see cref="reachedEndOfPath"/>
  81. /// </summary>
  82. [System.Obsolete("When unifying the interfaces for different movement scripts, this property has been renamed to reachedEndOfPath (lowercase t). [AstarUpgradable: 'TargetReached' -> 'reachedEndOfPath']")]
  83. public bool TargetReached { get { return reachedEndOfPath; } }
  84. /// <summary>
  85. /// True if a path to the target is currently being calculated.
  86. /// Deprecated: Use <see cref="pathPending"/> instead (lowercase 'p').
  87. /// </summary>
  88. [System.Obsolete("Use pathPending instead (lowercase 'p'). [AstarUpgradable: 'PathPending' -> 'pathPending']")]
  89. public bool PathPending { get { return pathPending; } }
  90. /// <summary>
  91. /// \details
  92. /// Deprecated: Use approachingPartEndpoint (lowercase 'a') instead
  93. /// </summary>
  94. [System.Obsolete("Use approachingPartEndpoint (lowercase 'a') instead")]
  95. public bool ApproachingPartEndpoint { get { return approachingPartEndpoint; } }
  96. /// <summary>
  97. /// \details
  98. /// Deprecated: Use approachingPathEndpoint (lowercase 'a') instead
  99. /// </summary>
  100. [System.Obsolete("Use approachingPathEndpoint (lowercase 'a') instead")]
  101. public bool ApproachingPathEndpoint { get { return approachingPathEndpoint; } }
  102. /// <summary>
  103. /// \details
  104. /// Deprecated: This property has been renamed to 'traversingOffMeshLink'
  105. /// </summary>
  106. [System.Obsolete("This property has been renamed to 'traversingOffMeshLink'. [AstarUpgradable: 'TraversingSpecial' -> 'traversingOffMeshLink']")]
  107. public bool TraversingSpecial { get { return traversingOffMeshLink; } }
  108. /// <summary>
  109. /// Current waypoint that the agent is moving towards.
  110. /// Deprecated: This property has been renamed to <see cref="steeringTarget"/>
  111. /// </summary>
  112. [System.Obsolete("This property has been renamed to steeringTarget")]
  113. public Vector3 TargetPoint { get { return steeringTarget; } }
  114. [UnityEngine.Serialization.FormerlySerializedAs("anim")][SerializeField][HideInInspector]
  115. Animation animCompatibility;
  116. /// <summary>
  117. /// Anim for off-mesh links.
  118. /// Deprecated: Use the onTraverseOffMeshLink event or the ... component instead. Setting this value will add a ... component
  119. /// </summary>
  120. [System.Obsolete("Use the onTraverseOffMeshLink event or the ... component instead. Setting this value will add a ... component")]
  121. public Animation anim {
  122. get {
  123. var setter = GetComponent<Pathfinding.Examples.AnimationLinkTraverser>();
  124. return setter != null ? setter.anim : null;
  125. }
  126. set {
  127. animCompatibility = null;
  128. var setter = GetComponent<Pathfinding.Examples.AnimationLinkTraverser>();
  129. if (setter == null) setter = gameObject.AddComponent<Pathfinding.Examples.AnimationLinkTraverser>();
  130. setter.anim = value;
  131. }
  132. }
  133. }
  134. }