// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.J)) { playerAnimation.Defend(true); shield.ActiveShield(true); } if (Input.GetKeyUp(KeyCode.J)) { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(false); shield.ActiveShield(false); } if (Input.GetKeyDown(KeyCode.K) || joyButton.isPressed && isAttack == false) { if (Random.Range(0, 2) > 0) { playerAnimation.Attack_1(); isAttack = true; soundFX.Attack_1(); } else { playerAnimation.Attack_2(); isAttack = true; soundFX.Attack_2(); } } else { isAttack = false; } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.J)) { playerAnimation.Defend(true); shield.ActiveShield(true); } if (Input.GetKeyUp(KeyCode.J)) { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(false); shield.ActiveShield(false); } if (Input.GetKeyDown(KeyCode.K) && isAttack == false) { if (!firstAttack) { playerAnimation.Attack_1(); firstAttack = true; } else if (secondAttack == false && firstAttack) { playerAnimation.Attack_2(); secondAttack = true; } else if (thirdAttack == false && secondAttack && firstAttack) { playerAnimation.Attack_3(); thirdAttack = true; } StartCoroutine(backtoAttack()); isAttack = true; } else { isAttack = false; } }