Fixed many things.

This commit is contained in:
2022-05-16 17:59:47 +07:00
parent 150efde055
commit 06fdfc077c
8 changed files with 290 additions and 41 deletions

View File

@ -52,7 +52,7 @@ public class MovementController : MonoBehaviour
{
return MapManager.Instance.NavPoints
.Where(point =>
(_idNavPointDict[PointStartID].Position - point.Position).magnitude < SettingsReader.Instance.GetSettings.MovementDistance)
(transform.position - point.Position).magnitude < SettingsReader.Instance.GetSettings.MovementDistance)
.ToList();
}
@ -69,15 +69,12 @@ public class MovementController : MonoBehaviour
{
if (navMeshAgent.isStopped == true) navMeshAgent.isStopped = false;
navMeshAgent.SetDestination(_idNavPointDict[PointStartID].Position);
PointEndID = PointStartID;
PointStartID = -1;
(PointEndID, PointStartID) = (PointStartID, PointEndID);
}
public void StopOnPath()
{
navMeshAgent.isStopped = true;
PointStartID = -1;
PointEndID = -1;
}
public void ReachedDestination()