use doubletime

This commit is contained in:
in0finite 2022-04-17 22:17:57 +02:00
parent 482842a259
commit 8318a3c9b1
2 changed files with 4 additions and 4 deletions

View file

@ -8,14 +8,14 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
public PathNode? currentNode; public PathNode? currentNode;
public PathNode? destinationNode; public PathNode? destinationNode;
public Vector3 moveDestination; public Vector3 moveDestination;
public float timeWhenAttemptedToFindClosestNode = 0f; public double timeWhenAttemptedToFindClosestNode = 0;
public void Cleanup() public void Cleanup()
{ {
this.currentNode = null; this.currentNode = null;
this.destinationNode = null; this.destinationNode = null;
this.moveDestination = Vector3.zero; this.moveDestination = Vector3.zero;
this.timeWhenAttemptedToFindClosestNode = 0f; this.timeWhenAttemptedToFindClosestNode = 0;
} }
} }
} }

View file

@ -136,10 +136,10 @@ namespace SanAndreasUnity.Behaviours.Peds.AI
public static void FindClosestWalkableNode(PathMovementData pathMovementData, Vector3 position) public static void FindClosestWalkableNode(PathMovementData pathMovementData, Vector3 position)
{ {
if (Time.time - pathMovementData.timeWhenAttemptedToFindClosestNode < 2f) // don't attempt to find it every frame if (Time.timeAsDouble - pathMovementData.timeWhenAttemptedToFindClosestNode < 2f) // don't attempt to find it every frame
return; return;
pathMovementData.timeWhenAttemptedToFindClosestNode = Time.time; pathMovementData.timeWhenAttemptedToFindClosestNode = Time.timeAsDouble;
var closestPathNodeToWalk = PedAI.GetClosestPathNodeToWalk(position); var closestPathNodeToWalk = PedAI.GetClosestPathNodeToWalk(position);
if (null == closestPathNodeToWalk) if (null == closestPathNodeToWalk)