40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using DG.Tweening;
|
|
namespace Kill.UI.Components
|
|
{
|
|
/// <summary>
|
|
/// 扇形扫描波纹效果
|
|
/// 支持动态调整扫描角度和最大距离
|
|
/// </summary>
|
|
public class SectorScanEffect : MonoBehaviour
|
|
{
|
|
public Image image;
|
|
public RectTransform line1;
|
|
public RectTransform line2;
|
|
public void SetAngle(float angle)
|
|
{
|
|
float p=angle/360;
|
|
float nowfill=image.fillAmount;
|
|
var t1= image.DOFillAmount(p,1);
|
|
t1.SetEase(Ease.Linear);
|
|
var t2=image.GetComponent<RectTransform>().DOLocalRotate(new Vector3(0,0,angle/2.0f),1);
|
|
t2.SetEase(Ease.Linear);
|
|
var t3=line1.DOLocalRotate(new Vector3(0,0,angle/2.0f),1);
|
|
t3.SetEase(Ease.Linear);
|
|
var t4=line2.DOLocalRotate(new Vector3(0,0,-angle/2.0f),1);
|
|
t4.SetEase(Ease.Linear);
|
|
|
|
}
|
|
|
|
public void SetDis(float dis)
|
|
{
|
|
float scaleValue=0.8f+((dis-2)/4)*0.4f;
|
|
var t= GetComponent<RectTransform>().DOScale(scaleValue,1);
|
|
t.SetEase(Ease.Linear);
|
|
}
|
|
}
|
|
}
|