/// <summary> /// Движение между объектами /// </summary> public void Move() { if (MoveManager.work.IsDistance(transform, target, minDistance)) { MoveManager.work.RotateTo(transform, target, speedRotate); MoveManager.work.MoveTo(transform, target, speedMove); } else { MoveManager.Stop(transform, target); } }
/// <summary> /// Остановить движение /// </summary> /// <param name="transform">Основной объект</param> /// <param name="target">Цель</param> public static void StopMove(this Transform transform, Transform target) { MoveManager.Stop(transform, target); }
/// <summary> /// Двигаться к данной цели /// </summary> /// <param name="transform">Основной объект</param> /// <param name="target">Цель</param> /// <param name="_minDistance">Минимальное допустимое растояние</param> /// <param name="_speedMove">Скорость движения</param> /// <param name="_speedRotate">Скорость поворота</param> public static void MoveTo(this Transform transform, Transform target, float _minDistance = 0, float _speedMove = 1, float _speedRotate = 5) { MoveManager.Add(transform, target, _speedMove, _speedRotate, _minDistance); }