diff --git a/Assets/Scripts/Gameplay/Data/Events/Arc.Judgement.cs b/Assets/Scripts/Gameplay/Data/Events/Arc.Judgement.cs index 90e0daf3..bb023a81 100644 --- a/Assets/Scripts/Gameplay/Data/Events/Arc.Judgement.cs +++ b/Assets/Scripts/Gameplay/Data/Events/Arc.Judgement.cs @@ -9,9 +9,10 @@ namespace ArcCreate.Gameplay.Data /// /// Partial class for judgement. /// - public partial class Arc : LongNote, ILongNote, IArcJudgementReceiver + public partial class Arc : LongNote, ILongNote, IArcJudgementReceiver, IArcTapJudgementReceiver { private int numJudgementRequestsSent = 0; + private bool sentTapBlockingJudgement = false; private bool highlightRequestSent = false; private bool spawnedParticleThisFrame = false; @@ -24,6 +25,7 @@ public void ResetJudgeTo(int timing) highlightRequestSent = false; arcGroupAlpha = 1; hasBeenHitOnce = hasBeenHitOnce && timing >= Timing && timing <= EndTiming; + sentTapBlockingJudgement = timing >= Timing; for (int i = 0; i < segments.Count; i++) { ArcSegmentData segment = segments[i]; @@ -81,6 +83,12 @@ public void UpdateJudgement(int currentTiming, GroupProperties groupProperties) highlightRequestSent = true; } + if (!IsTrace && currentTiming >= Timing - Values.MissJudgeWindow && !sentTapBlockingJudgement) + { + RequestTapBlockingJudgement(groupProperties); + sentTapBlockingJudgement = true; + } + spawnedParticleThisFrame = false; } @@ -132,6 +140,10 @@ public void ProcessArcJudgement(bool isExpired, bool isJudgement, GroupPropertie } } + public void ProcessArcTapJudgement(int offset, GroupProperties properties) + { + } + private void RequestJudgement(GroupProperties props) { for (int t = numJudgementRequestsSent; t < TotalCombo; t++) @@ -152,6 +164,21 @@ private void RequestJudgement(GroupProperties props) numJudgementRequestsSent = TotalCombo; } + private void RequestTapBlockingJudgement(GroupProperties props) + { + Services.Judgement.Request(new ArcTapJudgementRequest() + { + ExpireAtTiming = Timing, + AutoAtTiming = Timing, + IsBlocker = true, + Width = 1, + X = WorldXAt(0), + Y = WorldYAt(0), + Receiver = this, + Properties = props, + }); + } + private void RequestHighlight(int timing, GroupProperties props) { Services.Judgement.Request(new ArcJudgementRequest() diff --git a/Assets/Scripts/Gameplay/Data/Events/ArcTap.cs b/Assets/Scripts/Gameplay/Data/Events/ArcTap.cs index 31299d71..28a00ce5 100644 --- a/Assets/Scripts/Gameplay/Data/Events/ArcTap.cs +++ b/Assets/Scripts/Gameplay/Data/Events/ArcTap.cs @@ -163,6 +163,7 @@ private void RequestJudgement(GroupProperties props) X = WorldX, Y = WorldY, Width = Width, + IsBlocker = false, Receiver = this, Properties = props, }); diff --git a/Assets/Scripts/Gameplay/Judgement/Input/TouchInputHandler.cs b/Assets/Scripts/Gameplay/Judgement/Input/TouchInputHandler.cs index dac7d4e7..eff8743d 100644 --- a/Assets/Scripts/Gameplay/Judgement/Input/TouchInputHandler.cs +++ b/Assets/Scripts/Gameplay/Judgement/Input/TouchInputHandler.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using ArcCreate.Gameplay.Data; using ArcCreate.Utility; @@ -82,11 +83,6 @@ public void HandleTapRequests( { ArcTapJudgementRequest req = arcTapRequests[i]; int timingDifference = req.AutoAtTiming - currentTiming; - if (timingDifference > minTimingDifference) - { - continue; - } - Vector2 judgementSize = req.Properties.CurrentJudgementSize; Vector3 judgementOffset = req.Properties.CurrentJudgementOffset; Vector3 worldPosition = new Vector3(req.X, req.Y, 0) + judgementOffset; @@ -94,14 +90,33 @@ public void HandleTapRequests( Vector3 deltaToNote = screenPosition - input.ScreenPos; float distanceToNote = deltaToNote.sqrMagnitude; - if (ArcTapCollide(input, screenPosition, worldPosition, req.Width, judgementSize) - && (timingDifference < minTimingDifference || distanceToNote <= minPositionDifference)) + if (ArcTapCollide(input, screenPosition, worldPosition, req.Width, judgementSize)) { - minTimingDifference = timingDifference; - minPositionDifference = distanceToNote; - applicableArcTapRequestExists = true; - applicableArcTapRequest = req; - applicableArcTapRequestIndex = i; + if (timingDifference < minTimingDifference || distanceToNote <= minPositionDifference) + { + if (req.IsBlocker && + (minTimingDifference - timingDifference <= Values.MaxJudgeWindow + || currentTiming >= req.AutoAtTiming)) + { + continue; + } + + minTimingDifference = timingDifference; + minPositionDifference = distanceToNote; + applicableArcTapRequestExists = true; + applicableArcTapRequest = req; + applicableArcTapRequestIndex = i; + } + else if (timingDifference <= minTimingDifference + Values.MaxJudgeWindow + && applicableArcTapRequestExists && applicableArcTapRequest.IsBlocker + && !req.IsBlocker) + { + minTimingDifference = timingDifference; + minPositionDifference = distanceToNote; + applicableArcTapRequestExists = true; + applicableArcTapRequest = req; + applicableArcTapRequestIndex = i; + } } } diff --git a/Assets/Scripts/Gameplay/Judgement/Request/ArcTapJudgementRequest.cs b/Assets/Scripts/Gameplay/Judgement/Request/ArcTapJudgementRequest.cs index 8529b69e..5e875336 100644 --- a/Assets/Scripts/Gameplay/Judgement/Request/ArcTapJudgementRequest.cs +++ b/Assets/Scripts/Gameplay/Judgement/Request/ArcTapJudgementRequest.cs @@ -9,6 +9,7 @@ public struct ArcTapJudgementRequest public float X; public float Y; public float Width; + public bool IsBlocker; public IArcTapJudgementReceiver Receiver; public GroupProperties Properties; }