| 1234567891011121314151617181920212223242526 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CoilPolarWipeController : MonoBehaviour
- {
- public Material material;
- [Range(0f, 1f)]
- public float cutoff = 0f;
- public float speed = 0.5f;
- public bool loop = true;
- void Update()
- {
- if (material == null) return;
- cutoff += speed * Time.deltaTime;
- if (loop)
- cutoff = cutoff > 1f ? 0f : cutoff;
- else
- cutoff = Mathf.Clamp01(cutoff);
- material.SetFloat("_Cutoff", cutoff);
- }
- }
|