コード例 #1
0
 public static JudgementValue GetBaseJudgementValue()
 {
     if (baseJudgementValue == null)
     {
         baseJudgementValue = new JudgementValue();
     }
     return(baseJudgementValue);
 }
コード例 #2
0
        /// <summary>
        /// Get the JudgementValue below (worse than) the provided JudgementValue.
        /// </summary>
        /// <param name="judgement"></param>
        /// <returns></returns>
        static public JudgementValue GetNextJudgementValue(JudgementValue judgement)
        {
            JudgementValue result = GetMiss();

            for (int i = 0; i < Judgements.Count; i++)
            {
                result = Judgements[i];

                if (result.Judge > judgement.Judge)
                {
                    break;
                }
            }

            return(result);
        }
コード例 #3
0
ファイル: Scoring.cs プロジェクト: PulsarcGame/Pulsarc
        static public KeyValuePair <long, int> ProcessHitResults(JudgementValue judge, long currentScore, int currentComboMultiplier)
        {
            // Get the next score from a score and a new hit
            long score           = currentScore + judge.Score * currentComboMultiplier;
            int  comboMultiplier = currentComboMultiplier + judge.ComboAddition;

            if (comboMultiplier > MaxComboMultiplier)
            {
                comboMultiplier = MaxComboMultiplier;
            }
            else if (comboMultiplier < 1)
            {
                comboMultiplier = 1;
            }

            return(new KeyValuePair <long, int>(score, comboMultiplier));
        }
コード例 #4
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);
            }
        }
コード例 #5
0
        /// <summary>
        /// Get the JudgementValue above (better than) the provided JudgementValue.
        /// </summary>
        /// <param name="judgement"></param>
        /// <returns></returns>
        static public JudgementValue GetPreviousJudgementValue(JudgementValue judgement)
        {
            JudgementValue result = JudgementValue.GetBaseJudgementValue();

            for (int i = 0; i < Judgements.Count; i++)
            {
                if (Judgements[i].Judge >= judgement.Judge)
                {
                    break;
                }
                else
                {
                    result = Judgements[i];
                }
            }

            return(result);
        }
コード例 #6
0
        /// <summary>
        /// Finds the JudgementValue using the error provided, then returns it.
        /// </summary>
        /// <param name="error">The error of a hit. error = |arcTime - hitTime|</param>
        /// <returns>Returns the judgement that corresponds to the error amount.
        /// Returns null if the error is larger than all JudgementValues' Timing
        /// Windows.</returns>
        static public JudgementValue GetJudgementValueByError(int error)
        {
            JudgementValue result = null;

            if (error <= Judgements.Last().Judge)
            {
                for (int i = 0; i < Judgements.Count; i++)
                {
                    JudgementValue judgement = Judgements[i];

                    if (error <= judgement.Judge)
                    {
                        result = judgement;
                        break;
                    }
                }
            }

            return(result);
        }