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.
161 lines
4.1 KiB
161 lines
4.1 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using DG.Tweening;
|
|
|
|
namespace DisComputer
|
|
{
|
|
/// <summary>
|
|
/// Cpu细致动画拆分
|
|
/// </summary>
|
|
public class CpuDetailAni : MonoBehaviour
|
|
{
|
|
//散热
|
|
public Transform fan_Tran;
|
|
|
|
/// <summary>
|
|
/// 架子
|
|
/// </summary>
|
|
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()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置拆状态
|
|
/// </summary>
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置安装状态
|
|
/// </summary>
|
|
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;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 安装散热器
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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<BoltDriver>();
|
|
|
|
yield return StartCoroutine(driver.RotationLouSi());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 安装Cpu
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerator LoadCpuProgress()
|
|
{
|
|
|
|
cpu_Tran.DOLocalMove(cpuStart_pos, 0.5f).SetDelay(0.5f);
|
|
yield return new WaitForSeconds(1.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 拆解散热
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerator UnloadFanProgress()
|
|
{
|
|
BoltDriver driver = luosi_Tran.GetComponent<BoltDriver>();
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 拆解cpu动画
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public IEnumerator UnloadCpuProgress()
|
|
{
|
|
cpu_Tran.DOLocalMove(cpuEnd_pos, 0.5f).SetDelay(0.5f);
|
|
|
|
yield return new WaitForSeconds(2.0f);
|
|
luosi_Tran.gameObject.SetActive(false);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|