Exemple #1
0
        /// <summary>
        /// Handle the currently queued Inputs that may affect the gameplay
        /// </summary>
        private void HandleInputs()
        {
            // Prevents future input from being handled. Useful for auto. Remove for quick auto result testing
            while (InputManager.PressActions.Count > 0 &&
                   InputManager.PressActions.Peek().Key <= AudioManager.GetTime())
            {
                KeyValuePair <double, Keys> press = InputManager.PressActions.Dequeue();

                // If the key pressed isn't a bound key, ignore it
                if (!bindings.ContainsKey(press.Value))
                {
                    continue;
                }

                int column = bindings[press.Value];
                rawInputs.Add(new KeyValuePair <double, int>(press.Key, column));

                // If there is no hittable hit object available, ignore this press
                // TODO: instead of checking to see if there's anything left in the in Column,
                // How about seeing if there's any nearby arc times are within the
                // judge range of the press.
                if (!Columns[column].HitObjects.Exists(x => x.Hittable))
                {
                    continue;
                }

                HitObject pressed = Columns[column].HitObjects.Find(hO => hO.Hittable);

                int error = (int)((pressed.Time - press.Key) / Rate);

                // Get the judge for the timing error
                JudgementValue judge = Judgement.GetJudgementValueByError(Math.Abs(error));

                // If no judge is obtained, it is a ghost hit and is ignored score-wise
                if (judge == null)
                {
                    continue;
                }

                SampleManager.PlayHitSound(judge);
                notesSinceLastMiss++;

                ProcessHit(press, column, ref pressed, error, judge);
            }
        }