2026-04-27 중간저장
This commit is contained in:
8
Assets/02_Scripts/Data/Sound.meta
Normal file
8
Assets/02_Scripts/Data/Sound.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90c7baed664268f469f179b8f30bb8b3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/02_Scripts/Data/Sound/BGMClip.cs
Normal file
8
Assets/02_Scripts/Data/Sound/BGMClip.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = "Sound/BGMClip")]
|
||||
public class BGMClip : ScriptableObject
|
||||
{
|
||||
public string BGMName;
|
||||
public AudioClip Clip;
|
||||
}
|
||||
2
Assets/02_Scripts/Data/Sound/BGMClip.cs.meta
Normal file
2
Assets/02_Scripts/Data/Sound/BGMClip.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b017d3f0163ed5841bdd1041c4631412
|
||||
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
|
||||
28
Assets/02_Scripts/UI/BGMBox.cs
Normal file
28
Assets/02_Scripts/UI/BGMBox.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class BGMBox : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private BGMClip _bgmClip;
|
||||
|
||||
[Header("Refs")]
|
||||
[SerializeField] private TMP_Text _bgmNameField;
|
||||
[SerializeField] private GameObject _playSignObj;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_bgmNameField.text = _bgmClip.BGMName;
|
||||
}
|
||||
|
||||
public void PlayBGM()
|
||||
{
|
||||
SoundManager.Instance.PlayBGM(_bgmClip.Clip);
|
||||
_playSignObj.SetActive(true);
|
||||
}
|
||||
|
||||
public void StopBGM()
|
||||
{
|
||||
SoundManager.Instance.StopBGM();
|
||||
_playSignObj.SetActive(false);
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/BGMBox.cs.meta
Normal file
2
Assets/02_Scripts/UI/BGMBox.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fc531721f03e0741a8118d981947d3a
|
||||
21
Assets/02_Scripts/UI/BGMHud.cs
Normal file
21
Assets/02_Scripts/UI/BGMHud.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BGMHud : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject _contentRoot;
|
||||
[SerializeField] private GameObject _contentPrefab;
|
||||
|
||||
private BGMBox currentBgm;
|
||||
|
||||
public void PlayPickBGM(GameObject buttonObj)
|
||||
{
|
||||
if(currentBgm != null)
|
||||
currentBgm.StopBGM();
|
||||
|
||||
BGMBox bgmBox = buttonObj.GetComponentInParent<BGMBox>();
|
||||
bgmBox.PlayBGM();
|
||||
|
||||
currentBgm = bgmBox;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/BGMHud.cs.meta
Normal file
2
Assets/02_Scripts/UI/BGMHud.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c777974bd5467db43b82cea4e8481c01
|
||||
Reference in New Issue
Block a user