menu
This commit is contained in:
@@ -7,10 +7,14 @@ namespace Ichni.RhythmGame
|
||||
public class TouchAreaJudgeUnit : NoteJudgeUnit
|
||||
{
|
||||
public float areaRadius;
|
||||
protected override GameObject GetHintImagePrefab() => GameManager.instance.basePrefabs.areaHint;
|
||||
|
||||
protected override GameObject GetHintImagePrefab()
|
||||
{
|
||||
return GameManager.instance.basePrefabs.areaHint;
|
||||
}
|
||||
|
||||
private float CurrentScreenRatio() => Screen.width / 1920f;
|
||||
|
||||
|
||||
public TouchAreaJudgeUnit(NoteBase note, float areaRadius) : base(note)
|
||||
{
|
||||
this.areaRadius = areaRadius;
|
||||
@@ -18,7 +22,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void UpdateJudge()
|
||||
{
|
||||
if(note.isFirstJudged) return;
|
||||
if (note.isFirstJudged) return;
|
||||
Vector2 noteScreenPosition = note.noteScreenPosition;
|
||||
RectTransform canvasRect = GameManager.instance.judgeHintCanvas.GetComponent<RectTransform>();
|
||||
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, noteScreenPosition, null, out Vector2 uiPosition))
|
||||
@@ -37,21 +41,26 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
Vector2 inputScreenPosition = inputUnit.inputPosition;
|
||||
Vector2 noteScreenPosition = note.noteScreenPosition;
|
||||
|
||||
|
||||
float distance = Vector2.Distance(inputScreenPosition, noteScreenPosition);
|
||||
|
||||
//Debug.Log("Input Position: " + inputScreenPosition + ", Note Position: " + noteScreenPosition + ", Distance: " + distance);
|
||||
|
||||
if (distance <= areaRadius * CurrentScreenRatio())
|
||||
|
||||
|
||||
if (distance <= areaRadius)
|
||||
{
|
||||
if (inputUnit is InputUnitSwipe swipe && note is Flick flick)
|
||||
{
|
||||
return flick.CheckSwipeDirection(swipe.swipeDirection);
|
||||
return flick.CheckSwipeDirection(swipe);
|
||||
}
|
||||
|
||||
|
||||
Debug.Log("Input Position: " + inputScreenPosition +
|
||||
", Note Position: " + noteScreenPosition +
|
||||
", Distance: " + distance +
|
||||
", Area Radius: " + areaRadius +
|
||||
", Current Screen Ratio: " + CurrentScreenRatio());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +83,11 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override NoteJudgeUnit ConvertToGameType(NoteBase attachedNote)
|
||||
{
|
||||
return new TouchAreaJudgeUnit(attachedNote, areaRadius);
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE
|
||||
return new FullScreenNearTimeJudgeUnit(attachedNote);
|
||||
#elif UNITY_ANDROID || UNITY_IOS
|
||||
return new TouchAreaJudgeUnit(attachedNote, areaRadius);//TODO:改这里
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user