This commit is contained in:
PC-20230316NUNE\Administrator
2024-02-02 15:38:13 +08:00
parent 877dca3b43
commit 00f56e11c7
228 changed files with 36944 additions and 20084 deletions

View File

@@ -118,7 +118,7 @@ namespace Pathfinding.Legacy {
// gets confused because the first point in the path is far away
// from the current position (possibly behind it which could cause
// the agent to turn around, and that looks pretty bad).
Vector3 p1 = Time.time - lastFoundWaypointTime < 0.3f ? lastFoundWaypointPosition : p.originalStartPoint;
Vector3 p1 = GetSync().Time.time - lastFoundWaypointTime < 0.3f ? lastFoundWaypointPosition : p.originalStartPoint;
Vector3 p2 = GetFeetPosition();
Vector3 dir = p2-p1;
float magn = dir.magnitude;
@@ -154,7 +154,7 @@ namespace Pathfinding.Legacy {
} else if (rigid != null) {
rigid.AddForce(dir);
} else {
tr.Translate(dir*Time.deltaTime, Space.World);
tr.Translate(dir*GetSync().Time.deltaTime, Space.World);
}
}
@@ -204,7 +204,7 @@ namespace Pathfinding.Legacy {
//Mathfx.DistancePointSegmentStrict (vPath[currentWaypointIndex+1],vPath[currentWaypointIndex+2],currentPosition);
if (dist < pickNextWaypointDist*pickNextWaypointDist) {
lastFoundWaypointPosition = currentPosition;
lastFoundWaypointTime = Time.time;
lastFoundWaypointTime = GetSync().Time.time;
currentWaypointIndex++;
} else {
break;
@@ -245,8 +245,8 @@ namespace Pathfinding.Legacy {
Debug.DrawRay(GetFeetPosition(), forward*sp, Color.cyan);
#endif
if (Time.deltaTime > 0) {
sp = Mathf.Clamp(sp, 0, targetDist/(Time.deltaTime*2));
if (GetSync().Time.deltaTime > 0) {
sp = Mathf.Clamp(sp, 0, targetDist/(GetSync().Time.deltaTime*2));
}
return forward*sp;
@@ -263,7 +263,7 @@ namespace Pathfinding.Legacy {
Quaternion rot = tr.rotation;
Quaternion toTarget = Quaternion.LookRotation(dir);
rot = Quaternion.Slerp(rot, toTarget, turningSpeed*Time.deltaTime);
rot = Quaternion.Slerp(rot, toTarget, turningSpeed*GetSync().Time.deltaTime);
Vector3 euler = rot.eulerAngles;
euler.z = 0;
euler.x = 0;