using UnityEngine; namespace UltimateWater { public class RiverCurrent : MonoBehaviour { [SerializeField] private River _River; [SerializeField] [Tooltip("Scale of the force applied")] private float _Force = 1f; private Rigidbody _Rigidbody; private Transform _Transform; private void Awake() { _Transform = GetComponent(); _Rigidbody = GetComponent(); } private void FixedUpdate() { _Rigidbody.AddForceAtPosition(_River.GetCurrentForce(_Transform.position) * _Force, new Vector3(_Transform.position.x, 0f, _Transform.position.z)); } } }