using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
namespace DisComputer
{
///
/// Cpu细致动画拆分
///
public class CpuDetailAni : MonoBehaviour
{
//散热
public Transform fan_Tran;
///
/// 架子
///
public Transform shelf_Tran;
//架子开始位置
public Vector3 shelfStart_pos;
//架子结束位置
public Vector3 shelfEnd_pos;
//散热开始位置
public Vector3 fanStart_pos;
//散热结束位置
public Vector3 fanEnd_pos;
//Cpu
public Transform cpu_Tran;
//cpu开始位置
public Vector3 cpuStart_pos;
//cpu结束位置
public Vector3 cpuEnd_pos;
//螺丝
public Transform luosi_Tran;
//螺丝显示位置
public Vector3 luosi_showPos;
private void Awake()
{
}
///
/// 设置拆状态
///
public void SetUnLoadState()
{
//shelfStart_pos = shelf_Tran.localPosition;
fan_Tran.localPosition = fanStart_pos;
cpu_Tran.localPosition = cpuStart_pos;
shelf_Tran.localPosition = shelfStart_pos;
//Debug.LogFormat("*************** > Set Unload Cpu");
luosi_Tran.localPosition = Vector3.zero;
luosi_Tran.gameObject.SetActive(true);
}
///
/// 设置安装状态
///
public void SetLoadState()
{
//shelfStart_pos = shelf_Tran.localPosition;
//Debug.LogFormat("*************** > Set Load Cpu");
fan_Tran.localPosition = fanEnd_pos;
cpu_Tran.localPosition = cpuEnd_pos;
shelf_Tran.localPosition = shelfEnd_pos;
luosi_Tran.gameObject.SetActive(false);
luosi_Tran.localPosition = luosi_showPos;
}
///
/// 安装散热器
///
///
public IEnumerator LoadFanProgress()
{
Debug.LogFormat(">>>>>>>>>>>>> shelfStart_pos {0}", shelfStart_pos);
shelf_Tran.DOLocalMove(shelfStart_pos, 0.5f);
fan_Tran.DOLocalMove(fanStart_pos, 0.5f).SetDelay(0.3f);
luosi_Tran.localPosition = luosi_showPos;
yield return new WaitForSeconds(1.0f);
luosi_Tran.gameObject.SetActive(true);
luosi_Tran.DOLocalMove(Vector3.zero,0.5f);
yield return new WaitForSeconds(0.60f);
BoltDriver driver = luosi_Tran.GetComponent();
yield return StartCoroutine(driver.RotationLouSi());
}
///
/// 安装Cpu
///
///
public IEnumerator LoadCpuProgress()
{
cpu_Tran.DOLocalMove(cpuStart_pos, 0.5f).SetDelay(0.5f);
yield return new WaitForSeconds(1.0f);
}
///
/// 拆解散热
///
///
public IEnumerator UnloadFanProgress()
{
BoltDriver driver = luosi_Tran.GetComponent();
luosi_Tran.gameObject.SetActive(true);
yield return StartCoroutine(driver.RotationLouSi());
luosi_Tran.DOLocalMove(luosi_showPos,0.5f);
yield return new WaitForSeconds(1.0f);
shelf_Tran.DOLocalMove(shelfEnd_pos, 0.5f);
fan_Tran.DOLocalMove(fanEnd_pos, 0.5f).SetDelay(0.3f);
yield return new WaitForSeconds(1.5f);
}
///
/// 拆解cpu动画
///
///
public IEnumerator UnloadCpuProgress()
{
cpu_Tran.DOLocalMove(cpuEnd_pos, 0.5f).SetDelay(0.5f);
yield return new WaitForSeconds(2.0f);
luosi_Tran.gameObject.SetActive(false);
}
}
}