using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
///
/// 圆形遮罩镂空
///
public class CircleGuidance : MonoBehaviour
{
public static CircleGuidance instance;
///
/// 高亮显示目标
///
public Image target;
///
/// 区域范围缓存
///
private Vector3[] corners = new Vector3[4];
///
/// 镂空区域中心
///
private Vector4 center;
///
/// 镂空区域半径
///
private float radius;
///
/// 遮罩材质
///
private Material material;
///
/// 当前高亮区域半径
///
private float currentRadius;
///
/// 高亮区域缩放的动画时间
///
private float shrinkTime = 0.5f;
///
/// 事件渗透组件
///
private GuidanceEventPenetrate eventPenetrate;
private void Awake()
{
instance = this;
}
public void Init(Image target)
{
this.target = target;
eventPenetrate = GetComponent();
if (eventPenetrate != null)
{
eventPenetrate.SetTargetImage(target);
}
Canvas canvas = GameObject.Find("Canvas").GetComponent