kirill loh

This commit is contained in:
2022-04-18 10:53:21 +07:00
parent 5fb554f098
commit e1d0bbc1eb
12 changed files with 88 additions and 31 deletions

View File

@ -6,12 +6,12 @@ using UnityEngine.AI;
[RequireComponent(typeof(NavMeshAgent))]
public class MovementController : MonoBehaviour
{
public NavPoint currentPosition { get; private set; }
public NavPoint currentPosition { get; set; }
[SerializeField] private NavMeshAgent navMeshAgent;
private void Start()
{
navMeshAgent.speed = SettingsReader.Instance.GetSettings.movementSpeed;
navMeshAgent.speed = SettingsReader.Instance.GetSettings.movementSpeed;
}
public void MoveToRandomPoint()
@ -23,7 +23,7 @@ public class MovementController : MonoBehaviour
public List<NavPoint> getPointsCandidate()
{
return MapManager.navPoints
.Where(point => (currentPosition.position - point.position).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
.Where(point => (currentPosition.position - point.position).magnitude < SettingsReader.Instance.GetSettings.movementSpeed)
.ToList();
}