Quantcast
Channel: Answers by "doomprodigy"
Viewing all articles
Browse latest Browse all 90

Answer by doomprodigy

$
0
0
private int attackNum = 0; private bool attacking = false; void Update (){ if (Input.GetButtonDown("Attack")){ if (attacking == false){ if (attackNum == 0){ StartCoroutine("AttackOne"); attackNum += 1; } if (attackNum == 1){ StartCoroutine("AttackTwo"); //from here onwards you would either add another digit to attackNum and put another if statement asking if it is attackNum 2 or you would reset attackNum to 0 again then repeat sort of deal` } } } IEnumerator AttackOne () { attacking = true; //Do your attacking script here, you will also want to Wait for the animation to stop playing or use a yield return new WaitForSeconds(somenumber); then you turn attacking false then you can press it again and call a different attack script with different animations damage etc etc etc. attacking = false; } //Repeat the IEnumerator function with the different name, damage and animation. I also suggest adding a timer to start after the first attack that once it reaches a certain number it resets attackNum to 0 every swing you will need to reset the timer and start again. Attack One, start timer, attack two reset timer and start it, wait too long stop timer and reset it and reset attackNum to 0. Peace,

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>