TestMove.cs 592 B

1234567891011121314151617181920212223242526
  1. using DG.Tweening;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class TestMove : MonoBehaviour
  6. {
  7. public List<Transform> list_point;
  8. public Transform Player;
  9. private float times = 0;
  10. private int Index = 0;
  11. private void Update()
  12. {
  13. times += Time.deltaTime;
  14. if(times>2)
  15. {
  16. times = 0;
  17. Player.DOMove(list_point[Index].position, 1.5f);
  18. // Player.position = list_point[Index].position;
  19. Index++;
  20. Index = Index % list_point.Count;
  21. }
  22. }
  23. }