mirror of
https://gitee.com/jisol/jisol-game/
synced 2026-01-01 11:38:10 +00:00
提交
This commit is contained in:
@@ -42,7 +42,7 @@ namespace Pathfinding {
|
||||
/// If AstarPath.batchGraphUpdates is enabled, it is not beneficial to have a checkTime much lower
|
||||
/// than AstarPath.graphUpdateBatchingInterval because that will just add extra unnecessary graph updates.
|
||||
///
|
||||
/// In real time seconds (based on Time.realtimeSinceStartup).
|
||||
/// In real time seconds (based on GetSync().Time.realtimeSinceStartup).
|
||||
/// </summary>
|
||||
public float checkTime = 0.2F;
|
||||
|
||||
@@ -105,7 +105,9 @@ namespace Pathfinding {
|
||||
if (coll != null) prevEnabled = colliderEnabled;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
if (coll == null && coll2D == null) {
|
||||
@@ -121,11 +123,11 @@ namespace Pathfinding {
|
||||
pendingGraphUpdates.Dequeue();
|
||||
}
|
||||
|
||||
if (AstarPath.active == null || AstarPath.active.isScanning || Time.realtimeSinceStartup - lastCheckTime < checkTime || !Application.isPlaying || pendingGraphUpdates.Count > 0) {
|
||||
if (AstarPath.active == null || AstarPath.active.isScanning || GetSync().Time.realtimeSinceStartup - lastCheckTime < checkTime || !Application.isPlaying || pendingGraphUpdates.Count > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
lastCheckTime = Time.realtimeSinceStartup;
|
||||
lastCheckTime = GetSync().Time.realtimeSinceStartup;
|
||||
if (colliderEnabled) {
|
||||
// The current bounds of the collider
|
||||
Bounds newBounds = bounds;
|
||||
@@ -141,7 +143,7 @@ namespace Pathfinding {
|
||||
|
||||
// If the difference between the previous bounds and the new bounds is greater than some value, update the graphs
|
||||
if (minDiff.sqrMagnitude > updateError*updateError || maxDiff.sqrMagnitude > updateError*updateError ||
|
||||
errorFromRotation > updateError || !prevEnabled) {
|
||||
errorFromRotation > updateError || !prevEnabled) {
|
||||
// Update the graphs as soon as possible
|
||||
DoUpdateGraphs();
|
||||
}
|
||||
@@ -225,7 +227,7 @@ namespace Pathfinding {
|
||||
prevRotation = tr.rotation;
|
||||
|
||||
// Set this here as well since the DoUpdateGraphs method can be called from other scripts
|
||||
lastCheckTime = Time.realtimeSinceStartup;
|
||||
lastCheckTime = GetSync().Time.realtimeSinceStartup;
|
||||
}
|
||||
|
||||
/// <summary>Volume of a Bounds object. X*Y*Z</summary>
|
||||
|
||||
Reference in New Issue
Block a user