using UnityEngine; [AddComponentMenu("")] [System.Obsolete("Legacy prototype note script. Do not use in gameplay.", false)] public class Notes : MonoBehaviour { public int trackIndex; public float hitTime; private bool canBeJudged = false; private bool isHit = false; private void OnEnable() { enabled = false; Debug.LogWarning("[Notes] Legacy prototype script was enabled. It has been disabled automatically and is not part of the current gameplay pipeline.", this); } private void Update() { if (canBeJudged && !isHit && Time.timeSinceLevelLoad > hitTime + 0.3f) { JudgeMiss(); } } private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("JudgmentLine")) { canBeJudged = true; } } private void OnTriggerExit2D(Collider2D other) { if (other.CompareTag("JudgmentLine")) { canBeJudged = false; } } public void JudgeNote() { if (!canBeJudged || isHit) { return; } float currentTime = Time.timeSinceLevelLoad; float timeDifference = Mathf.Abs(currentTime - hitTime); if (timeDifference <= 0.05f) { JudgePerfect(); } else if (timeDifference <= 0.1f) { JudgeGreat(); } else if (timeDifference <= 0.2f) { JudgeGood(); } else if (timeDifference <= 0.3f) { JudgeMiss(); } } private void Recycle() { if (NotePool.Instance != null) { NotePool.Instance.ReturnNote(gameObject, "red"); } else { Destroy(gameObject); } } private void JudgePerfect() { Debug.Log($"Track {trackIndex}: Perfect!"); isHit = true; Recycle(); } private void JudgeGreat() { Debug.Log($"Track {trackIndex}: Great!"); isHit = true; Recycle(); } private void JudgeGood() { Debug.Log($"Track {trackIndex}: Good!"); isHit = true; Recycle(); } private void JudgeMiss() { Debug.Log($"Track {trackIndex}: Miss!"); isHit = true; Recycle(); } }