private void FlashingOn(Collider other)//闪烁控制
{
if (other.transform.GetComponent<OutlineObject>() == null)
other.gameObject.AddComponent<OutlineObject>().Material = new Material(Shader.Find("Knife/Knife-HDRPOutline_Unlit"));
other.transform.GetComponent<OutlineObject>().Color = color;
if (tweener == null)
tweener = DOTween.ToAlpha(() => color, a => color = a, 0, speed).SetLoops(-1, LoopType.Yoyo).SetEase(ease);
if (colliders.Count > 0 && !tweener.IsPlaying())
tweener.Play();
}
private void FlashingOff(Collider other)
{
if (1 << other.gameObject.layer == layerMask.value)
{
if (other.transform.GetComponent<OutlineObject>())
other.transform.GetComponent<OutlineObject>().Color = Color.clear;
if (colliders.Contains(other))
colliders.Remove(other);
}
}
unity 控制 材质球 闪烁
于 2022-07-19 17:27:52 首次发布