latest changes

This commit is contained in:
2022-04-18 09:34:08 +07:00
parent 1691020ece
commit 29fec74bd4
35 changed files with 742 additions and 4025 deletions

View File

@ -14,27 +14,19 @@ public class MovementController : MonoBehaviour
navMeshAgent.speed = SettingsReader.Instance.GetSettings.movementSpeed;
}
public void Move()
{
var pointCandidate = getPointCandidate();
goToNextNavPoint(pointCandidate);
}
public void MoveToRandomPoint()
{
Debug.Log(MapManager.navPoints == null);
goToNextNavPoint(MapManager.navPoints[Random.Range(0, MapManager.navPoints.Count)]);
}
private NavPoint getPointCandidate()
public List<NavPoint> getPointsCandidate()
{
var NavPointsPositions = MapManager.navPoints
.Select(point => point.transform.position)
.Where(point => (currentPosition.transform.position - point).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
return MapManager.navPoints
.Where(point => (currentPosition.position - point.position).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
.ToList();
return null;
}
public void goToNextNavPoint(NavPoint destination) =>
navMeshAgent.SetDestination(destination.transform.position);
navMeshAgent.SetDestination(destination.position);
}