Пример #1
0
 /// <summary>
 /// Based on the type of input, calls the right function for the minigame to perform.
 /// This is in essence the evaluator.
 /// </summary>
 /// <param name="typeOfHit"></param>
 public void CheckHit(string typeOfHit)
 {
     // Early.
     if (Conductor.instance.songPosition >= nextPerfectHit - goodHitOffset - earlyHitOffset &&
         Conductor.instance.songPosition < nextPerfectHit - goodHitOffset)
     {
         if (typeOfHit == "LETGO")
         {
             currentMiniGame.EarlyHit(true);
         }
         else if (typeOfHit == notes[currentNoteInt].typeOfHit)
         {
             currentMiniGame.EarlyHit(false);
         }
         else
         {
             currentMiniGame.BadHit(true, false);
         }
     }
     // Good.
     else if (Conductor.instance.songPosition >= nextPerfectHit - goodHitOffset &&
              Conductor.instance.songPosition < nextPerfectHit + goodHitOffset)
     {
         if (typeOfHit == "LETGO")
         {
             currentMiniGame.GoodHit(true);
         }
         else if (typeOfHit == notes[currentNoteInt].typeOfHit)
         {
             currentMiniGame.GoodHit(false);
         }
         else
         {
             currentMiniGame.BadHit(true, false);
         }
     }
     // Late.
     else if (Conductor.instance.songPosition >= nextPerfectHit + goodHitOffset &&
              Conductor.instance.songPosition < nextPerfectHit + goodHitOffset + lateHitOffset)
     {
         if (typeOfHit == "LETGO")
         {
             currentMiniGame.LateHit(true);
         }
         else if (typeOfHit == notes[currentNoteInt].typeOfHit)
         {
             currentMiniGame.LateHit(false);
         }
         else
         {
             currentMiniGame.BadHit(true, false);
         }
     }
     // Bad or Miss.
     else
     {
         if (currentNoteInt > 0 && notes[currentNoteInt].continuous && notes[currentNoteInt - 1].continuous && notes[currentNoteInt - 1].typeOfHit == "HOLD")
         {
             if (typeOfHit == "LETGO")
             {
                 currentMiniGame.BadHit(true, true);
             }
             else
             {
                 currentMiniGame.BadHit(true, false);
             }
         }
         else
         {
             // Miss.
             if (typeOfHit == "LETGO")
             {
                 currentMiniGame.BadHit(false, true);
             }
             else
             {
                 currentMiniGame.BadHit(false, false);
             }
         }
     }
 }