Check out example codes for "object escape player unity". It will help you in understanding the concepts better.

Code Example 1

Vector3 dir = transform.position - Target.position;
transform.Translate(dir * moveSpeed * Time.deltaTime);

Learn ReactJs, React Native from akashmittal.com