客户端rsa,冗余清理,bug修复,安卓build问题
This commit is contained in:
@@ -1,100 +1,109 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Notes : MonoBehaviour
|
||||
{
|
||||
public int trackIndex; // Documentation text normalized.
|
||||
public float hitTime; // Documentation text normalized.
|
||||
private bool canBeJudged = false; // Documentation text normalized.
|
||||
private bool isHit = false; // Documentation text normalized.
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// Documentation text normalized.
|
||||
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; // Documentation text normalized.
|
||||
|
||||
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()
|
||||
{
|
||||
// Documentation text normalized.
|
||||
if (NotePool.Instance != null)
|
||||
{
|
||||
NotePool.Instance.ReturnNote(gameObject, "red"); // Documentation text normalized.
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user