Exemple #1
0
        public void RegisterHit()
        {
            var time = _controller.Elapsed;

            if (CurrentBeat != null)
            {
                var denom = Math.Abs(CurrentBeat.HitTime - time);
                //if (denom == 0) denom = 1; //if you someone manage to match the note exactly, get the full amount
                var score = Convert.ToInt64(Math.Abs((_controller.Separation * 5 * 2) - denom * 2));
                if (score < 0)
                {
                    score = 0;
                }
                //scoring is STILL wrong, it gives you more points for being off rhythm
                switch (_currentVelo)
                {
                case ScoreVelo.Bad:
                case ScoreVelo.OK:
                    _controller.UpdateCombo(ComboChange.Break);
                    break;

                default:
                    _controller.UpdateCombo(ComboChange.Add);
                    break;
                }
                _controller.OnHitReg?.Invoke(_currentVelo);
                _controller.AddToScore(score);
                _controller.AddToHits(_currentVelo);
                PastBeats.Add(CurrentBeat);
                CurrentBeat = null;
            }
        }
Exemple #2
0
 public void UpdateBeat()
 {
     if (CurrentBeat != null)
     {
         var time = _controller.Elapsed;
         if (_timing == Timing.Early && CurrentBeat.HitTime < time)
         {
             _timing = Timing.Late;
         }
         if (_timing == Timing.Early)
         {
             //each stage needs to display for 25ms, or 250 (the separation)
             //perfect should be 125ms each side of the actual time, so:
             //Great = hittime +- 375
             if (time < CurrentBeat.HitTime - (_controller.HalfSep + _controller.Separation * 4))
             {
                 _currentVelo = ScoreVelo.Bad;
             }
             else if (time < CurrentBeat.HitTime - (_controller.HalfSep + _controller.Separation * 3))
             {
                 _currentVelo = ScoreVelo.OK;
             }
             else if (time < CurrentBeat.HitTime - (_controller.HalfSep + _controller.Separation * 2))
             {
                 _currentVelo = ScoreVelo.Good;
             }
             else if (time < CurrentBeat.HitTime - (_controller.HalfSep + _controller.Separation))
             {
                 _currentVelo = ScoreVelo.Great;
             }
             else if (time < CurrentBeat.HitTime - _controller.HalfSep)
             {
                 _currentVelo = ScoreVelo.Perfect;
             }
         }
         else
         {
             if (time > CurrentBeat.HitTime + _controller.Separation * 5)
             {
                 _currentVelo = ScoreVelo.Miss;
                 ClearPad();
                 PastBeats.Add(CurrentBeat);
                 _controller.UpdateCombo(ComboChange.Break);
                 _controller.AddToHits(_currentVelo);
                 _controller.OnHitReg?.Invoke(_currentVelo);
                 CurrentBeat = null;
             }
             else if (time > CurrentBeat.HitTime + (_controller.HalfSep + _controller.Separation * 4))
             {
                 _currentVelo = ScoreVelo.Bad;
             }
             else if (time > CurrentBeat.HitTime + (_controller.HalfSep + _controller.Separation * 3))
             {
                 _currentVelo = ScoreVelo.OK;
             }
             else if (time > CurrentBeat.HitTime + (_controller.HalfSep + _controller.Separation * 2))
             {
                 _currentVelo = ScoreVelo.Good;
             }
             else if (time > CurrentBeat.HitTime + (_controller.HalfSep + _controller.Separation))
             {
                 _currentVelo = ScoreVelo.Great;
             }
         }
         LightPad((int)_currentVelo);
     }
 }