Merge branch 'krazerleo/core/1' of https://gitea.gavt45.ru/gav/real-shooter into krazerleo/core/1
This commit is contained in:
@ -6,11 +6,18 @@ using UnityEngine.AI;
|
||||
[RequireComponent(typeof(NavMeshAgent))]
|
||||
public class MovementController : MonoBehaviour
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
public int PointStartID { get; set; }
|
||||
public int PointEndID { get; private set; }
|
||||
public float FlagDistance { get; private set; }
|
||||
private const float updateFlagPositionDelay = 5;
|
||||
private const float updateReachedDestinationDelay = 5;
|
||||
=======
|
||||
public NavPoint currentPosition { get; set; }
|
||||
private Dictionary<int, NavPoint> navPoints = new Dictionary<int, NavPoint>();
|
||||
|
||||
[SerializeField] private NavMeshAgent navMeshAgent;
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
|
||||
[SerializeField] private NavMeshAgent navMeshAgent;
|
||||
[SerializeField] private GameObject flag;
|
||||
@ -21,6 +28,7 @@ public class MovementController : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
navMeshAgent.speed = SettingsReader.Instance.GetSettings.MovementSpeed;
|
||||
idNavPointDict = MapManager.IDToNavPoint;
|
||||
InvokeRepeating(nameof(UpdateFlagPosition), 0, updateFlagPositionDelay);
|
||||
@ -35,19 +43,46 @@ public class MovementController : MonoBehaviour
|
||||
private void UpdateFlagPosition()
|
||||
{
|
||||
FlagDistance = (flag.transform.position - gameObject.transform.position).magnitude;
|
||||
=======
|
||||
navMeshAgent.speed = SettingsReader.Instance.GetSettings.movementSpeed;
|
||||
foreach (var np in MapManager.navPoints) {
|
||||
navPoints[np.PointId] = np;
|
||||
}
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
}
|
||||
|
||||
public void MoveToPointById(int id)
|
||||
{
|
||||
if (!navPoints.ContainsKey(id))
|
||||
{
|
||||
Debug.LogWarning("PIDOR");
|
||||
return;
|
||||
}
|
||||
goToNextNavPoint(navPoints[id]);
|
||||
}
|
||||
|
||||
public void MoveToRandomPoint()
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
Debug.Log(MapManager.NavPoints == null);
|
||||
GoToNextNavPoint(MapManager.NavPoints[Random.Range(0, MapManager.NavPoints.Count)]);
|
||||
=======
|
||||
{
|
||||
// Debug.Log(MapManager.navPoints == null);
|
||||
goToNextNavPoint(MapManager.navPoints[Random.Range(0, MapManager.navPoints.Count)]);
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
}
|
||||
|
||||
public List<NavPoint> GetPointsCandidate()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
return MapManager.NavPoints
|
||||
.Where(point =>
|
||||
(idNavPointDict[PointStartID].Position - point.Position).magnitude < SettingsReader.Instance.GetSettings.MovementDistance)
|
||||
=======
|
||||
return MapManager.navPoints
|
||||
.Where(point => (currentPosition.position - point.position).magnitude < SettingsReader.Instance.GetSettings.movementDistance)
|
||||
>>>>>>> 351fa8ee12c499a0374be71a192a5f288611f467
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user