From 4ad4cc91fa400ee26bd080c5324174d91e4672c1 Mon Sep 17 00:00:00 2001 From: Jiangqvweihuan <15987148+jiangqvweihuan@user.noreply.gitee.com> Date: Sun, 20 Jul 2025 03:04:48 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Assets/s?= =?UTF-8?q?cripts/gamePlay=5Fgameplay/NewBehaviourScript.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gamePlay_gameplay/NewBehaviourScript.cs | 87 ------------------- 1 file changed, 87 deletions(-) delete mode 100644 Assets/scripts/gamePlay_gameplay/NewBehaviourScript.cs diff --git a/Assets/scripts/gamePlay_gameplay/NewBehaviourScript.cs b/Assets/scripts/gamePlay_gameplay/NewBehaviourScript.cs deleted file mode 100644 index 490957bd..00000000 --- a/Assets/scripts/gamePlay_gameplay/NewBehaviourScript.cs +++ /dev/null @@ -1,87 +0,0 @@ -using UnityEngine; - -public class Notes : MonoBehaviour -{ - public int trackIndex; // 轨道索引 - public float hitTime; // 该音符应该被击中的时间 - private bool canBeJudged = false; // 是否进入判定区域 - private bool isHit = false; // 是否已被击中 - - private void Update() - { - // 过了 Miss 判定时间,销毁音符 - if (!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 JudgePerfect() - { - Debug.Log($"Track {trackIndex}: Perfect!"); - isHit = true; - Destroy(gameObject); - } - - private void JudgeGreat() - { - Debug.Log($"Track {trackIndex}: Great!"); - isHit = true; - Destroy(gameObject); - } - - private void JudgeGood() - { - Debug.Log($"Track {trackIndex}: Good!"); - isHit = true; - Destroy(gameObject); - } - - private void JudgeMiss() - { - Debug.Log($"Track {trackIndex}: Miss!"); - isHit = true; - Destroy(gameObject); - } -}