Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. private IEnumerator FirstAttack() {
  2.  
  3. comboCounter = 1;
  4.  
  5. myAnimator.SetInteger("comboSequence", comboCounter);
  6.  
  7. currentState = PlayerState.attack;
  8. 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
  9.  
  10. StartCoroutine(IntervalCounter());
  11. comboCounter = 0;
  12. myAnimator.SetInteger("comboSequence", comboCounter);
  13. currentState = PlayerState.walk;
  14.  
  15. }
  16.  
  17. private IEnumerator SecondAttack()
  18. {
  19.  
  20. comboCounter = 2;
  21. myAnimator.SetInteger("comboSequence", comboCounter);
  22. currentState = PlayerState.attack;
  23. yield return null;
  24.  
  25. yield return new WaitForSeconds(AttackTemplate.SetDuration(0.9f));
  26. comboCounter = 0;
  27. myAnimator.SetInteger("comboSequence", comboCounter);
  28.  
  29. currentState = PlayerState.walk;
  30.  
  31. }
  32.  
  33.  
  34. private IEnumerator IntervalCounter()
  35. {
  36. comboTimer = AttackTemplate.SetComboTimer(0.4f);
  37. while (comboTimer >= 0)
  38. {
  39. Debug.Log(comboTimer);
  40. comboTimer -= Time.deltaTime;
  41. if (Input.GetKeyDown(KeyCode.Mouse0))
  42. {
  43. Debug.Log("Chained");
  44. StartCoroutine(SecondAttack());
  45. yield break;
  46. }
  47. yield return null;
  48. }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement