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.

75 lines
1.7 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using LzFramework;
namespace DisComputer
{
/*
*@func 动画播放组件
* @autor lz
*
*/
public class UIAnimator : MonoBehaviour
{
public static UIAnimator Singleton
{
get
{
return SingletonCreator.Create<UIAnimator>();
}
}
/// <summary>
/// 按钮点击动效
/// </summary>
/// <param name="target">目标</param>
/// <param name="scaleVal">缩放指书</param>
/// <param name="interval">间隔</param>
public void BtnShakeAct(Transform target,float scaleVal,float interval)
{
Sequence mysequence = DOTween.Sequence();
mysequence.Append(target.DOScale(new Vector3(scaleVal, scaleVal, scaleVal), interval * 0.5f)).SetEase(Ease.InSine);
mysequence.Append(target.DOScale(new Vector3(1, 1, 1), interval * 0.5f)).SetEase(Ease.InSine);
}
private bool isCool = false;
public bool CoolInterval(float interval)
{
if (isCool)
{
return true;
}else
{
isCool = true;
StartCoroutine("CoolProgress", interval);
return false;
}
}
/// <summary>
/// 冷却进度
/// </summary>
/// <returns></returns>
IEnumerator CoolProgress(float interval)
{
//Debug.Log("进入冷却");
yield return new WaitForSeconds(interval);
isCool = false;
//Debug.Log("冷却完成");
}
}
}