Example #1
0
 public static void InterpretKeyPress(CoderKey key)
 {
     if (key == BackspaceKey && ErrorCount > 0)
     {
         DeactivateKey(key);
         instance.audio.PlayOneShot(instance.typingSound);
         CoderOutput.DeleteError();
         ErrorCount--;
         if (ErrorCount == 0)
         {
             ActivateKey(MissedActiveKey);
         }
         else
         {
             ActivateKey(BackspaceKey);
         }
     }
     else if (key == ActiveKey)
     {
         key.Deactivate();
         instance.audio.PlayOneShot(instance.typingSound);
         CoderOutput.PrintLine();
         CoderScoreboard.GetPoint();
         ActivateKey(PickRandomKeyNoRepeats());
     }
     else
     {
         if (ErrorCount == 0)
         {
             // If not backspace, save it for later
             MissedActiveKey = ActiveKey;
         }
         DeactivateKey(ActiveKey);
         instance.audio.PlayOneShot(instance.errorSound);
         CoderOutput.PrintError();
         ActivateKey(BackspaceKey);
         ErrorCount = 1;             // Track all errors with single boolean
         // ErrorCount++; // Track each error individually
     }
 }
Example #2
0
 void Awake()
 {
     instance = this;
 }