public class MoveEnem : MonoBehaviour
{
public Vector2 startPos;
public Vector2 endPos;
public float step;
private float progress;
void Start()
{
transform.position = startPos;
}
void Update()
{
transform.position = Vector2.Lerp(startPos, endPos, progress);
progress += step;
}
}
transform.position = Vector2.Lerp(startPos, endPos, 0.5f+0.5f*Mathf.Sin(progress));