using System.Collections.Generic; using UnityEngine; public enum Result { Perfect, Good, Miss } public class RhythmManager : MonoBehaviour { [SerializeField] private AudioSource _audioSource; [SerializeField] private RhythmChart _currentChart; private float SongTime => _audioSource.time; // 모든 타이밍의 기준 private List SongNoteList; private bool _isPlaying; //곡이 재생 중인지 (종료 감지용) private void Start() { ChangeSong(); } private void Update() { //재생 중이던 곡이 끝나면 주변음 복구 if (_isPlaying && !_audioSource.isPlaying) { StopSong(); } } public void ChangeSong() { _audioSource.clip = _currentChart.SongClip; } // 곡 재생 + 채보 로드 public void StartSong() { SongNoteList = _currentChart.GenerateNotes(); _audioSource.Play(); _isPlaying = true; //BGM·환경음을 낮춰 리듬게임 소리만 들리게 if (SoundManager.Instance != null) SoundManager.Instance.EnterMinigameMode(); } // 곡 정지 + 주변음 복구 public void StopSong() { _audioSource.Stop(); _isPlaying = false; if (SoundManager.Instance != null) SoundManager.Instance.ExitMinigameMode(); } public void OnPlayerInput() { } public Result Judge(float diff) { return Result.Miss; } }