2026-04-27 중간저장
This commit is contained in:
37
Assets/02_Scripts/Interact/RayInteractionFeedback.cs
Normal file
37
Assets/02_Scripts/Interact/RayInteractionFeedback.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
|
||||
public class RayInteractionFeedback : MonoBehaviour
|
||||
{
|
||||
[Header("Refs")]
|
||||
[SerializeField] private Animator _anim;
|
||||
[SerializeField] private AudioSource _audioSource;
|
||||
|
||||
|
||||
[Header("Content")]
|
||||
[SerializeField] private string _animTriggerName;
|
||||
|
||||
[SerializeField] private AudioClip _audioClip;
|
||||
|
||||
private bool _soundOnOff = true;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void HandleActivated(ActivateEventArgs args)
|
||||
{
|
||||
_anim.SetTrigger(_animTriggerName);
|
||||
|
||||
if(_soundOnOff)
|
||||
{
|
||||
_audioSource.PlayOneShot(_audioClip);
|
||||
}
|
||||
}
|
||||
|
||||
public void InteractionSoundOnOff(bool isOn)
|
||||
{
|
||||
_soundOnOff = isOn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20220875a7285a541935ef907867f29b
|
||||
Reference in New Issue
Block a user