// Some of this code is duplicated in Crosshairs.cs. Perhaps give us a reference to the crosshairs, and just aim towards that. // Also, obviously there's going to be some complicated logic here, Carlos is working on that. this is just for testing. private void HandleFiring() { bool lmb = Input.GetMouseButton(0); bool rmb = Input.GetMouseButton(1); _Crosshair.SetShooting(lmb | rmb); // for animations _IsFiring = lmb | rmb; if (Input.GetMouseButton(0)) { // On first frame of state change, play audio. if (!_IsFiringMG) { AkSoundEngine.PostEvent("Play_MachineGun", gameObject); } _IsFiringMG = true; _WH.Attack(0, transform.rotation); } else { if (_IsFiringMG) { AkSoundEngine.PostEvent("Stop_MachineGun", gameObject); } _IsFiringMG = false; } // Now do shotgun. if (Input.GetMouseButtonDown(1)) { if (!_IsFiringShotty) { AkSoundEngine.PostEvent("Play_Shotgun", gameObject); } _IsFiringShotty = true; _WH.Attack(1, transform.rotation); } else { _IsFiringShotty = false; } }