31 lines
720 B
C#
31 lines
720 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class DissolveEffect : MonoBehaviour
|
||
|
{
|
||
|
public float Time;
|
||
|
List<Renderer> _renderer = new List<Renderer>();
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
_renderer.AddRange(GetComponentsInChildren<Renderer>());
|
||
|
}
|
||
|
|
||
|
[ContextMenu("Dissolve")]
|
||
|
public void Dissolve()
|
||
|
{
|
||
|
LeanTween.value(0, 1, Time).setOnUpdate((float x) =>
|
||
|
{
|
||
|
for (int i = 0; i < _renderer.Count; i++)
|
||
|
{
|
||
|
for (int h = 0; h < _renderer[i].materials.Length; h++)
|
||
|
{
|
||
|
_renderer[i].materials[h].SetFloat("_Dissolve", x);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|