You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using System;
namespace DisComputer
{
/*
* @func 螺丝刀动画控制
*
* */
public class BoltDriver : MonoBehaviour
{
//螺丝位置点
public List<Transform> lousiTrans;
public Transform driver;
private void Start()
{
driver.gameObject.SetActive(false);
}
public IEnumerator RotationLouSi()
{
yield return new WaitForEndOfFrame();
driver.gameObject.SetActive(true);
Tween driverT = driver.DOLocalRotate(new Vector3(360, 0, 0), 2.0f, RotateMode.FastBeyond360).SetLoops(-1).SetEase(Ease.Linear);
for (int i = 0; i < lousiTrans.Count; i++){
driverT.Pause();
driver.DOLocalMove(lousiTrans[i].localPosition, 0.55f).SetEase(Ease.Linear);
yield return new WaitForSeconds(0.55f);
driverT.Play();
yield return new WaitForSeconds(1.0f);
driverT.Pause();
driver.DOLocalMoveX(driver.localPosition.x + .15f, 0.5f).SetEase(Ease.Linear);
yield return new WaitForSeconds(0.75f);
}
driver.gameObject.SetActive(false);
}
}
}