Initial. Added files

This commit is contained in:
Andrey Gumirov
2022-04-12 11:54:05 +07:00
parent 19900f6446
commit 8aa8e3d79b
254 changed files with 44750 additions and 0 deletions

View File

@ -0,0 +1,38 @@
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
[RequireComponent(typeof(NavMeshAgent))]
public class MovementController : MonoBehaviour
{
public NavPoint currentPosition { get; private set; }
[SerializeField] private MapManager mapManager;
[SerializeField] private NavMeshAgent navMeshAgent;
private void Start()
{
navMeshAgent.speed = SettingsReader.Instance.GetSettings.movementSpeed;
}
public void Move()
{
var pointCandidate = getPointCandidate();
goToNextNavPoint(pointCandidate);
}
// todo внутри сенсора передавать в mlagents как variable length observations: https://github.com/Unity-Technologies/ml-agents/blob/main/docs/Learning-Environment-Design-Agents.md#variable-length-observations
private NavPoint getPointCandidate()
{
var NavPointsPositions = mapManager.navPoints
.Select(point => point.transform.position)
.Where(point => (currentPosition.transform.position - point).magnitude <= SettingsReader.Instance.GetSettings.movementSpeed)
.ToList();
//TODO AI
return null;
}
private void goToNextNavPoint(NavPoint destination) =>
navMeshAgent.SetDestination(destination.transform.position);
}