forked from p7b2slgip/p65rsvefi
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.
60 lines
1.7 KiB
60 lines
1.7 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()
|
|
{
|
|
driver.gameObject.SetActive(true);
|
|
Tween driverT = driver.DOLocalRotate(new Vector3(360, 0, 0), 2.0f, RotateMode.FastBeyond360).SetLoops(-1).SetEase(Ease.Linear);
|
|
driverT.Pause();
|
|
Sequence sequence = DOTween.Sequence();
|
|
bool isFinish = true;
|
|
sequence.Append(
|
|
driver.DOLocalMove(lousiTrans[0].localPosition, 0.55f).SetEase(Ease.Linear).
|
|
OnComplete(() => {
|
|
driverT.Play();
|
|
})).Append(
|
|
driver.DOLocalMoveX(driver.localPosition.x + .3f, 0.5f).SetEase(Ease.Linear).SetDelay(1.0f)
|
|
)
|
|
.Append(
|
|
driver.DOLocalMove(lousiTrans[1].localPosition, 0.5f).SetEase(Ease.Linear)
|
|
).Append(
|
|
driver.DOLocalMoveX(driver.localPosition.x + 0.3f, 0.5f).SetEase(Ease.Linear).SetDelay(1.0f)
|
|
).OnComplete(()=>
|
|
{
|
|
driverT.Pause();
|
|
driver.gameObject.SetActive(false);
|
|
isFinish = false;
|
|
});
|
|
|
|
while (isFinish)
|
|
{
|
|
yield return new WaitForEndOfFrame();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|