63 lines
1.5 KiB
C#
63 lines
1.5 KiB
C#
using System.Collections;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream.FixSystem
|
|
{
|
|
public class BottleShelf : MonoBehaviour
|
|
{
|
|
[Header("整体位置")]
|
|
public Vector3 showPos;
|
|
public Vector3 hidePos;
|
|
|
|
[Header("动画时间")]
|
|
public float showDuration;
|
|
|
|
#region 引用
|
|
|
|
private BottleSlot[] _bottleSlots;
|
|
|
|
#endregion
|
|
|
|
private void Awake()
|
|
{
|
|
gameObject.SetActive(false);
|
|
transform.localPosition = hidePos;
|
|
|
|
InitRefs();
|
|
}
|
|
|
|
private void InitRefs()
|
|
{
|
|
_bottleSlots = GetComponentsInChildren<BottleSlot>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示泵机UI
|
|
/// </summary>
|
|
/// <returns>显示</returns>
|
|
public IEnumerator Show()
|
|
{
|
|
gameObject.SetActive(true);
|
|
Tween tween = transform.DOLocalMove(showPos, showDuration);
|
|
while (tween.active && !tween.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 隐藏泵机UI
|
|
/// </summary>
|
|
/// <returns>隐藏</returns>
|
|
public IEnumerator Hide()
|
|
{
|
|
Tween tween = transform.DOLocalMove(hidePos, showDuration);
|
|
while (tween.active && !tween.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
} |