Well, i'm making and FPS, and i'm having trouble with the Aim Down Sights thing, well, i'm my gun script, i have this lines, that play animation and sound when i shoot (press Fire1):
if(Input.GetButton("Fire1")){
if(ammo > 0){
if(shootTime > 0.1) {
ammo--;
audio.clip = shootSound;
audio.Play();
animation.Play("FireAnim1"); Instantiate(bullet,gunBarrel.position,gunBarrel.rotation);
shootTime = 0;
(All variables are alright).
But them, i made an Aim Down Sights system based on animations, so I added this lines:
if(Input.GetButtonDown("Fire2")){
animation.Play("ADSAnim1");
}
if(Input.GetButtonUp("Fire2")){
animation.Play("ADSAnim2");
}
But then, while I hold "Fire2" the gun stays in ADS position (ok till now) but when i shoot (press Fire1) qhile holding "Fire2", the gun goes to the non-ads position, plays the normal shooting animation, and then stays there, till I stop holding "Fire2" (then it plays "ADSAnim2", wich is the reverse of the "ADSAnim1", in other words, the gun goes from the ADS position to the normal position).
Well i tried adding some lines like if(Input.GetButtonDown("Fire2")); //Don't play animation
or something like this but i'm not skilled in JavaScript so idk how to do that.
Please help me and sorry for my english, hope you understood all :D
↧