2026-06-18 자동관련
This commit is contained in:
@@ -21,7 +21,12 @@ public class RhythmManager : MonoBehaviour
|
||||
|
||||
[Header("오토플레이 (아이템)")]
|
||||
[SerializeField] private bool _autoPlay; // 켜지면 모든 노트를 판정선 도달 순간 자동 Perfect 처리
|
||||
[SerializeField] private RhythmStick[] _autoPlaySticks; // 인덱스 = Note.Lane. 오토플레이 시 자동으로 휘두를 스틱들
|
||||
[SerializeField] private RhythmStick[] _autoPlaySticks; // 인덱스 = Note.Lane. 오토플레이 시 자동으로 휘두를 "자동 전용" 스틱들 (그랩 X)
|
||||
|
||||
[Header("오토플레이 전환 (수동 ↔ 자동 스틱)")]
|
||||
[SerializeField] private GameObject[] _autoPlayShowObjects; // 자동 시 켤 것: 자동 전용 스틱(손 모델 포함)
|
||||
[SerializeField] private GameObject[] _autoPlayHideObjects; // 자동 시 끌 것: 그랩 스틱·실제 손 등
|
||||
[SerializeField] private Collider[] _drumPadColliders; // 자동 시 비활성화할 드럼패드 콜라이더 (자동 타격이 수동 입력 안 끼치게)
|
||||
|
||||
[SerializeField] private GameObject StartButtonObj;
|
||||
|
||||
@@ -69,6 +74,8 @@ private void Start()
|
||||
InputManager.Instance.OnKey_Right_Event += OnPlayerInput;
|
||||
|
||||
_rhythmCats = FindObjectsByType<RhythmCat>(FindObjectsSortMode.None);
|
||||
|
||||
ApplyAutoPlayState(false); // 기준 상태: 자동 스틱 숨김, 수동 스틱/손·드럼패드 활성
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -159,7 +166,28 @@ public void ChangeSong()
|
||||
}
|
||||
|
||||
// 오토플레이 아이템 사용: 곡 시작 전(또는 도중)에 호출하면 남은 노트가 전부 자동 Perfect
|
||||
public void EnableAutoPlay() => _autoPlay = true;
|
||||
public void EnableAutoPlay()
|
||||
{
|
||||
_autoPlay = true;
|
||||
ApplyAutoPlayState(true); // 자동 스틱 켜고, 수동 스틱·손·드럼패드 콜라이더 끔
|
||||
}
|
||||
|
||||
// 오토플레이 비주얼/충돌 전환.
|
||||
// on=true → 자동 전용 스틱 표시 + 수동 스틱/손 숨김 + 드럼패드 콜라이더 비활성
|
||||
private void ApplyAutoPlayState(bool on)
|
||||
{
|
||||
if (_autoPlayShowObjects != null)
|
||||
foreach (GameObject go in _autoPlayShowObjects)
|
||||
if (go != null) go.SetActive(on);
|
||||
|
||||
if (_autoPlayHideObjects != null)
|
||||
foreach (GameObject go in _autoPlayHideObjects)
|
||||
if (go != null) go.SetActive(!on);
|
||||
|
||||
if (_drumPadColliders != null)
|
||||
foreach (Collider col in _drumPadColliders)
|
||||
if (col != null) col.enabled = !on;
|
||||
}
|
||||
|
||||
// 시작 버튼 핸들러: 곧장 시작하지 않고 VR 준비 시간(카운트다운) 후 BeginSong 호출
|
||||
public void StartSong()
|
||||
@@ -245,9 +273,14 @@ public void StopSong()
|
||||
_audioSource.Stop();
|
||||
_isPlaying = false;
|
||||
|
||||
if (_autoPlay && _autoPlaySticks != null) // 곡 끝나면 들려있던 스틱 대기 자세로 복귀
|
||||
foreach (RhythmStick stick in _autoPlaySticks)
|
||||
if (stick != null) stick.ResetPose();
|
||||
if (_autoPlay)
|
||||
{
|
||||
if (_autoPlaySticks != null) // 곡 끝나면 들려있던 스틱 대기 자세로 복귀
|
||||
foreach (RhythmStick stick in _autoPlaySticks)
|
||||
if (stick != null) stick.ResetPose();
|
||||
|
||||
ApplyAutoPlayState(false); // 수동 스틱·손·드럼패드 콜라이더 복구
|
||||
}
|
||||
|
||||
_autoPlay = false; // 아이템 효과는 한 곡만 — 곡이 끝나면 자동 해제
|
||||
|
||||
|
||||
Reference in New Issue
Block a user