45 lines
949 B
C#
45 lines
949 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Es.WaveformProvider.Sample
|
|
{
|
|
public class RandomWaveInput : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private float waitTime = 0.5f;
|
|
|
|
[SerializeField]
|
|
private Texture2D waveform;
|
|
|
|
[SerializeField]
|
|
[Range(0f, 1f)]
|
|
private float inputScale = 0.05f;
|
|
|
|
[SerializeField]
|
|
[Range(0f, 1f)]
|
|
private float inputStrength = 0.1f;
|
|
|
|
[SerializeField]
|
|
private List<WaveConductor> targets;
|
|
|
|
private void Start()
|
|
{
|
|
StartCoroutine(RandomInput());
|
|
}
|
|
|
|
private IEnumerator RandomInput()
|
|
{
|
|
while (true)
|
|
{
|
|
yield return new WaitForSeconds(waitTime);
|
|
using List<WaveConductor>.Enumerator enumerator = targets.GetEnumerator();
|
|
while (enumerator.MoveNext())
|
|
{
|
|
enumerator.Current.Input(uv: new Vector2(Random.Range(0f, 1f), Random.Range(0f, 1f)), waveform: waveform, scale: inputScale, strength: inputStrength);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|