コード例 #1
0
ファイル: CoderWeapon.cs プロジェクト: puzzud/Knight-Shift
    public static void TargetKey(CoderKey key)
    {
        instance.targetKey = key;
        if (instance.animation.isPlaying)
        {
            instance.animation.Stop();
        }
        instance.animation.Play("AxeSwing-" + key.name);

        instance.knightAnim.SetBool("Swing", false);
        instance.knightAnim.SetBool("Swing", true);
        instance.knightAnim.SetBool("Swing", false);
    }
コード例 #2
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
     }
 }
コード例 #3
0
 private static void DeactivateKey(CoderKey key)
 {
     key.Deactivate();
     //LastActiveKey = ActiveKey;
     ActiveKey = null;
 }
コード例 #4
0
 private static void ActivateKey(CoderKey key)
 {
     key.Activate();
     ActiveKey = key;
 }