H_SafeExperienceDrivingSystem/U3D_DrivingSystem/Assets/Temp/test.cs

34 lines
827 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class test : MonoBehaviour
{
private bool isRotate;
// Start is called before the first frame update
void Start()
{
StartCoroutine(wait());
}
IEnumerator wait()
{
yield return new WaitForSeconds(2.5f);
transform.DOScale(new Vector3(2, 2, 2), 1).OnPlay(() => transform.DOMove(new Vector3(1, 1f, 0), 1).OnComplete(() => isRotate = true));
yield return new WaitForSeconds(30);
transform.DOScale(Vector3.zero, 1f).OnPlay(() => transform.DOMove(new Vector3(8, 8f, 0), 1.5f));
}
// Update is called once per frame
void Update()
{
if (isRotate)
{
transform.Rotate(0, -20*Time.deltaTime, 0);
}
}
}