30 lines
568 B
C#
30 lines
568 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Dissolver : MonoBehaviour
|
|
{
|
|
private Material mat;
|
|
private float time;
|
|
private bool isEnabled;
|
|
|
|
private void Start()
|
|
{
|
|
mat = GetComponent<Renderer>().material;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (time <= 1f && isEnabled)
|
|
{
|
|
time += Time.deltaTime / 2f;
|
|
mat.SetFloat("_DissolveAmount", time);
|
|
}
|
|
}
|
|
|
|
public void Enabled()
|
|
{
|
|
isEnabled = true;
|
|
time = -1f;
|
|
}
|
|
} |