31 lines
647 B
C#
31 lines
647 B
C#
using UnityEngine;
|
|
|
|
namespace Es.WaveformProvider.Sample
|
|
{
|
|
public class MouseWaveInput : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Texture2D waveform;
|
|
|
|
[SerializeField]
|
|
[Range(0f, 1f)]
|
|
private float waveScale = 0.05f;
|
|
|
|
[SerializeField]
|
|
[Range(0f, 1f)]
|
|
private float strength = 0.1f;
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetMouseButton(0) && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hitInfo))
|
|
{
|
|
WaveConductor component = hitInfo.transform.GetComponent<WaveConductor>();
|
|
if (component != null)
|
|
{
|
|
component.Input(waveform, hitInfo, waveScale, strength);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|