- Home /
Only trigger when in specific animation
Hello Everyone, im new to Untiy and making an FPS game, so far, everything works fine, but I have a small problem I want it so that i can only use this
if(Input.GetButtonDown ("Shoot")){ //Click
ammo = ammo-1; //Lose Ammo
animation.Play ("SHOOT");
}
Only when animation IDLE is playing, so I cant shoot a second time when the shoot animation is already playing if you know what I mean
THanks in advance
Answer by Wolfram · Aug 06, 2010 at 10:55 PM
This should work:
if(Input.GetButtonDown ("Shoot") && animation.IsPlaying("IDLE")){ //Click
ammo = ammo-1; //Lose Ammo
animation.Play ("SHOOT");
}
(EDIT: corrected)
Answer by Lastowl · Aug 06, 2010 at 10:38 PM
i think i understand at http://www.unifycommunity.com/wiki/index.php?title=FPSWalkerEnhanced it has a modified fpswalker script and it has code to stop people jumping continuous by what they called antibunnyhop, you could adapt it for shooting, theirs a C sharp and a Javascript as well.