remify minigame CatsRhythmGame

This commit is contained in:
2026-06-12 13:12:11 +09:00
parent c3210a2a7c
commit d4a76a2a97
10570 changed files with 602580 additions and 7 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 530804bf39738fb46a20083311a62bb2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,63 @@
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<Note> 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;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9ec2053dc012a8a4787fb75f0d113881

View File

@@ -30,6 +30,11 @@ public class SoundManager : MonoBehaviour
[Header("SFX Pool")]
[SerializeField] private int _sfxPoolSize = 10; //시작 시 미리 생성할 SFX 소스 개수
[Header("Snapshots")]
[SerializeField] private AudioMixerSnapshot _normalSnapshot; //평상시 믹서 상태
[SerializeField] private AudioMixerSnapshot _minigameSnapshot; //미니게임 중 BGM·환경음을 낮춘 상태
[SerializeField] private float _snapshotFadeDuration = 0.5f; //스냅샷 전환 페이드 시간
//구역 → BGM 빠른 조회용 (런타임 변환)
private readonly Dictionary<Zone, AudioClip> _zoneBgmMap = new();
@@ -231,4 +236,18 @@ public void SetVolume(string exposedParam, float normalized)
float db = normalized <= 0.0001f ? -80f : Mathf.Log10(normalized) * 20f;
_mainMixer.SetFloat(exposedParam, db);
}
//=========================== Snapshot ===========================
//미니게임 시작: BGM·환경음을 낮춘 스냅샷으로 페이드 전환
public void EnterMinigameMode()
{
if (_minigameSnapshot != null) _minigameSnapshot.TransitionTo(_snapshotFadeDuration);
}
//미니게임 종료: 평상시 스냅샷으로 복귀
public void ExitMinigameMode()
{
if (_normalSnapshot != null) _normalSnapshot.TransitionTo(_snapshotFadeDuration);
}
}