rabidus-test/Assets/Amazing Assets/Advanced Dissolve/Example Scenes/Tutorial Scenes/Files/Scripts/AnimateCutout.cs

30 lines
939 B
C#

using UnityEngine;
using AmazingAssets.AdvancedDissolve;
namespace AmazingAssets.AdvancedDissolve.ExampleScripts
{
public class AnimateCutout : MonoBehaviour
{
Material material;
public float offset;
public float time;
private void Start()
{
material = GetComponent<Renderer>().material;
AmazingAssets.AdvancedDissolve.AdvancedDissolveProperties.Cutout.Standard.UpdateLocalProperty(material, AdvancedDissolveProperties.Cutout.Standard.Property.Clip, offset);
}
[ContextMenu("debug cutout")]
public void StartCutout()
{
LeanTween.value(offset, 1, time).setOnUpdate((float x) =>
{
AmazingAssets.AdvancedDissolve.AdvancedDissolveProperties.Cutout.Standard.UpdateLocalProperty(material, AdvancedDissolveProperties.Cutout.Standard.Property.Clip, x);
});
}
}
}