@@ -20,6 +20,7 @@ public partial class BattleDirector : Node2D
2020 [ Export ]
2121 public InputHandler IH ;
2222
23+ [ Export ]
2324 private NotePlacementBar NotePlacementBar ;
2425
2526 private double _timingInterval = .1 ; //secs
@@ -118,7 +119,6 @@ public override void _Ready()
118119
119120 Player = GetNode < HealthBar > ( "PlayerHP" ) ;
120121 Enemy = GetNode < HealthBar > ( "EnemyHP" ) ;
121- NotePlacementBar = GetNode < NotePlacementBar > ( "NotePlacementBar" ) ;
122122
123123 CM . Connect ( nameof ( InputHandler . NotePressed ) , new Callable ( this , nameof ( OnNotePressed ) ) ) ;
124124 CM . Connect ( nameof ( InputHandler . NoteReleased ) , new Callable ( this , nameof ( OnNoteReleased ) ) ) ;
@@ -130,8 +130,7 @@ public override void _Process(double delta)
130130 CheckMiss ( ) ;
131131 }
132132
133- #region Input
134-
133+ #region Input&Timing
135134 private void OnNotePressed ( NoteArrow . ArrowType type )
136135 {
137136 CheckNoteTiming ( type ) ;
@@ -142,22 +141,23 @@ private void OnNoteReleased(NoteArrow.ArrowType arrowType) { }
142141 //Check all lanes for misses from missed inputs
143142 private void CheckMiss ( )
144143 {
145- double curBeat = TimeKeeper . CurrentTime / ( 60 / ( double ) _curSong . Bpm ) ;
144+ double curBeat = TimeKeeper . CurrentTime / ( 60 / ( double ) _curSong . Bpm ) % CM . BeatsPerLoop ;
146145 for ( int i = 0 ; i < _laneData . Length ; i ++ )
147146 {
148147 if ( _laneData [ i ] . Length <= 0 )
149148 continue ;
150149 double beatDif = ( curBeat - GetFirstNote ( ( NoteArrow . ArrowType ) i ) . Beat ) ;
151- if ( beatDif > 1 )
150+ if ( beatDif > 1 && _laneData [ i ] . First ( ) . Visible ) //Can change, currently using visible as a stand in for already activated.
152151 {
152+ _laneData [ i ] . First ( ) . NoteHit ( ) ;
153153 HandleTiming ( ( NoteArrow . ArrowType ) i , Math . Abs ( beatDif ) ) ;
154154 }
155155 }
156156 }
157157
158158 private void CheckNoteTiming ( NoteArrow . ArrowType type )
159159 {
160- double curBeat = TimeKeeper . CurrentTime / ( 60 / ( double ) _curSong . Bpm ) ;
160+ double curBeat = TimeKeeper . CurrentTime / ( 60 / ( double ) _curSong . Bpm ) % CM . BeatsPerLoop ;
161161 if ( _laneData [ ( int ) type ] . Length == 0 )
162162 return ;
163163 double beatDif = Math . Abs ( curBeat - GetFirstNote ( type ) . Beat ) ;
@@ -170,9 +170,7 @@ private void CheckNoteTiming(NoteArrow.ArrowType type)
170170
171171 private void HandleTiming ( NoteArrow . ArrowType type , double beatDif )
172172 {
173- //Cycle note queue
174- CycleNote ( type ) . Beat += CM . BeatsPerLoop ;
175- //Do timing stuff
173+ CycleNote ( type ) ;
176174 if ( beatDif < _timingInterval * 2 )
177175 {
178176 GD . Print ( "Perfect" ) ;
0 commit comments