NewBehaviourScript.cs 769 B

1234567891011121314151617181920212223242526272829303132
  1. using DG.Tweening;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class NewBehaviourScript : MonoBehaviour
  6. {
  7. float times = 0;
  8. float MoveSpeed = 10;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. transform.DORotate(new Vector3(0, 200, 0), 10f);
  13. // transform.DOMove(transform.localPosition+new Vector3(0,0,5), 3f);
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. // transform.Translate(Vector3.forward * MoveSpeed * Time.deltaTime, Space.Self);
  19. times += Time.deltaTime;
  20. if (times > 1)
  21. {
  22. times = 0;
  23. transform.DOMove(transform.localPosition + transform.forward, 1f);
  24. }
  25. }
  26. }