冷却器表现添加,进入手术室timeline添加,其他表现优化
This commit is contained in:
@@ -19,6 +19,14 @@ public class HeatMapController : MonoBehaviour
|
||||
|
||||
public GameObject heatmapGameobject;
|
||||
|
||||
public RectTransform imageToMove; // 需要移动的Image
|
||||
public Transform imageToRotate; // 需要旋转的Image
|
||||
public Vector3 inPos; // Heatmap进入位置
|
||||
public Vector3 outPos; // Heatmap退出位置
|
||||
|
||||
|
||||
private Vector3 imageInitialPos; // Image的初始位置
|
||||
|
||||
[HideInInspector] private Vector4[] points = new Vector4[7]; // 存储6个点的数组,(x, y, z) = center, w = temperature
|
||||
|
||||
[HideInInspector] private Vector4[] properties = new Vector4[7]; // 存储6个盒子大小的数组, (x,y) = boxsize
|
||||
@@ -55,11 +63,27 @@ public class HeatMapController : MonoBehaviour
|
||||
|
||||
public void ShowHeatMap()
|
||||
{
|
||||
heatmapGameobject.SetActive(true);
|
||||
heatmapGameobject.GetComponent<DraggableUI>().isDone = false;
|
||||
StartCoroutine(ShowHeatMapCoroutine());
|
||||
}
|
||||
|
||||
private IEnumerator ShowHeatMapCoroutine()
|
||||
{
|
||||
// 初始化Heatmap位置
|
||||
heatmapGameobject.transform.localPosition = outPos;
|
||||
heatmapGameobject.SetActive(true);
|
||||
heatmapGameobject.transform.DOLocalMove(inPos, 1f);
|
||||
heatmapGameobject.GetComponent<DraggableUI>().isDone = false;
|
||||
yield return new WaitForSeconds(1f); // 等待动画完成
|
||||
heatmapGameobject.GetComponent<DraggableUI>().UnlockDrag();
|
||||
}
|
||||
|
||||
public void HideHeatMap()
|
||||
{
|
||||
var draggableUI = heatmapGameobject.GetComponent<DraggableUI>();
|
||||
heatmapGameobject.transform.DOLocalMove(outPos, 1f).OnComplete(() =>
|
||||
{
|
||||
draggableUI.UnlockDrag();
|
||||
});
|
||||
heatmapGameobject.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -68,29 +92,48 @@ public class HeatMapController : MonoBehaviour
|
||||
StartCoroutine(ReduceValueCoroutine());
|
||||
}
|
||||
|
||||
IEnumerator ReduceValueCoroutine()
|
||||
IEnumerator ReduceValueCoroutine()
|
||||
{
|
||||
if (Tempture>=2)
|
||||
var draggableUI = heatmapGameobject.GetComponent<DraggableUI>();
|
||||
draggableUI.LockDrag();
|
||||
|
||||
// 存储初始位置
|
||||
imageInitialPos = imageToMove.localPosition;
|
||||
|
||||
// 移动和旋转动画
|
||||
imageToMove.DOLocalMoveX(imageInitialPos.x + 3.5f, 1f);
|
||||
var rotationTween = imageToRotate.DORotate(new Vector3(0, 0, 360), 1f, RotateMode.FastBeyond360)
|
||||
.SetLoops(-1, LoopType.Restart)
|
||||
.SetEase(Ease.Linear);
|
||||
|
||||
if (Tempture < 2)
|
||||
{
|
||||
Debug.Log("降温失败");
|
||||
heatmapGameobject.GetComponent<DraggableUI>().isDone = true;
|
||||
yield return new WaitForSeconds(1);
|
||||
if(DialogController.Instance!=null)
|
||||
DialogController.Instance.StartDialogNode("降温失败");
|
||||
yield break;
|
||||
Debug.Log("降温成功");
|
||||
float duration = 3.5f;
|
||||
SetTemptureSmooth(0, duration);
|
||||
AudioManager.RandomPlayInteraction("cooler_cooling");
|
||||
yield return new WaitForSeconds(duration);
|
||||
rotationTween.Kill();
|
||||
imageToRotate.localRotation = Quaternion.identity;
|
||||
// 恢复初始状态
|
||||
imageToMove.DOLocalMove(imageInitialPos, 1f);
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
DialogController.Instance.StartDialogNode("降温成功");
|
||||
bodyModuleSystem.OnCooling();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("降温成功");
|
||||
heatmapGameobject.GetComponent<DraggableUI>().isDone = true;
|
||||
float duration = 2f;
|
||||
SetTemptureSmooth(0,duration);
|
||||
AudioManager.RandomPlayInteraction("cooler_cooling");
|
||||
yield return new WaitForSeconds(duration);
|
||||
DialogController.Instance.StartDialogNode("降温成功");
|
||||
bodyModuleSystem.OnCooling();
|
||||
Debug.Log("Value has reached zero.");
|
||||
Debug.Log("降温失败");
|
||||
yield return new WaitForSeconds(3f);
|
||||
DialogController.Instance.StartDialogNode("降温失败");
|
||||
}
|
||||
|
||||
// 停止旋转
|
||||
rotationTween.Kill();
|
||||
imageToRotate.localRotation = Quaternion.identity;
|
||||
|
||||
// 恢复初始状态
|
||||
imageToMove.DOLocalMove(imageInitialPos, 1f);
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user