feixing.cs 724 B

123456789101112131415161718192021222324252627282930
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using DG.Tweening;
  5. using UnityEngine.UI;
  6. public class feixing : MonoBehaviour
  7. {
  8. int ct = 0;
  9. public List<GameObject> feixingdian = new List<GameObject>();
  10. void Start()
  11. {
  12. next();
  13. }
  14. public void next()
  15. {
  16. this.transform.DOMove(feixingdian[ct].transform.position, Vector3.Distance(this.transform.position, feixingdian[ct].transform.position) * 0.01f).OnComplete(()=> { ct++;
  17. if(feixingdian.Count <= ct)
  18. {
  19. ct = 0;
  20. }
  21. next();
  22. }).SetEase(Ease.Linear);
  23. this.transform.DOLookAt(feixingdian[ct].transform.position,5f);
  24. }
  25. }