Almost Final Version
This commit is contained in:
@ -1,11 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
[RequireComponent(typeof(NavMeshAgent))]
|
||||
public class MovementController : MonoBehaviour
|
||||
{
|
||||
private Transform _firePointTransform;
|
||||
public int PointStartID { get; set; }
|
||||
public int PointEndID { get; private set; }
|
||||
public float FlagDistance { get; private set; }
|
||||
@ -17,7 +20,6 @@ public class MovementController : MonoBehaviour
|
||||
public float DistanceToGo { get; private set; }
|
||||
public float RemainingDistance => navMeshAgent.remainingDistance;
|
||||
public Vector3 Velocity => navMeshAgent.velocity;
|
||||
|
||||
private Dictionary<int, NavPoint> _idNavPointDict;
|
||||
|
||||
|
||||
@ -25,10 +27,11 @@ public class MovementController : MonoBehaviour
|
||||
{
|
||||
navMeshAgent.speed = SettingsReader.Instance.GetSettings.MovementSpeed;
|
||||
_idNavPointDict = MapManager.Instance.IDToNavPoint;
|
||||
_firePointTransform = transform.GetChild(0);
|
||||
InvokeRepeating(nameof(UpdateFlagPosition), 0, UpdateFlagPositionDelay);
|
||||
InvokeRepeating(nameof(ReachedDestination), 0, UpdateReachedDestinationDelay);
|
||||
}
|
||||
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
CancelInvoke(nameof(UpdateFlagPosition));
|
||||
|
Reference in New Issue
Block a user