Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private IEnumerator FirstAttack() {
- comboCounter = 1;
- myAnimator.SetInteger("comboSequence", comboCounter);
- currentState = PlayerState.attack;
- yield return new WaitForSeconds(AttackTemplate.SetDuration(0.6f) - comboTimer);//Problem: if i reduce the time below the animation time of the second animation, the second animation won't go until the end
- StartCoroutine(IntervalCounter());
- comboCounter = 0;
- myAnimator.SetInteger("comboSequence", comboCounter);
- currentState = PlayerState.walk;
- }
- private IEnumerator SecondAttack()
- {
- comboCounter = 2;
- myAnimator.SetInteger("comboSequence", comboCounter);
- currentState = PlayerState.attack;
- yield return null;
- yield return new WaitForSeconds(AttackTemplate.SetDuration(0.9f));
- comboCounter = 0;
- myAnimator.SetInteger("comboSequence", comboCounter);
- currentState = PlayerState.walk;
- }
- private IEnumerator IntervalCounter()
- {
- comboTimer = AttackTemplate.SetComboTimer(0.4f);
- while (comboTimer >= 0)
- {
- Debug.Log(comboTimer);
- comboTimer -= Time.deltaTime;
- if (Input.GetKeyDown(KeyCode.Mouse0))
- {
- Debug.Log("Chained");
- StartCoroutine(SecondAttack());
- yield break;
- }
- yield return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement