Okay I would like to do is make a swinging sword swinging script and limit how fast you can do this. I know how to use yield in java but I'me having trouble translating to c#.
I've tried to use bool
IEnumerator Up() {
canswing=false;
yield return new WaitForSeconds(3);
canswing=true;
}
that gave me errors so I separated true and false with two different functions I have no way of testing that out because Its not even calling on the IEnumerator function how would I call upon it through Update at the click of a button
this is my current script
public bool canswing = true;
IEnumerator Up() {
haswung();
yield return new WaitForSeconds(3);
Return();
}
void Update () {
if(canswing){
if(Input.GetMouseButtonDown(0)){
animation.Play("swing");
Up();
}}
}
void haswung(){
canswing=false;
}
void Return(){
canswing=true;
}
↧