protected bool TrackedFire() { if (slideController != null) { if (slideController.IsLocked()) { return(false); } } if (!roundChambered) { return(false); } // Round cycle sequence roundChambered = false; slideController.ChamberRoundVisible(roundChambered); Fire(); if (ConsumeOneFromMagazine()) { roundChambered = true; slideController.ChamberRoundVisible(roundChambered); slideController.BlowBack(); } else { isRacked = false; isPulledBack = true; chamberRoundOnNext = true; // playSoundOnNext = true; slideController.LastShot(); } UpdateAmmoCounter(); return(true); }
protected void LateUpdate() { if ((slideObject.transform.localPosition.z <= PULL_THRESHOLD) && !isPulledBack) { if (slideController != null) { if (slideController.IsHeld()) { //currentSlideState = false; if (pullbackSound != null) { pullbackSound.Play(); } isPulledBack = true; isRacked = false; playSoundOnNext = true; slideController.LockedBackState(); FrameworkCore.Animate(Animations, module.openAnimationRef); shellReceiver.data.disableTouch = false; //if (shellReceiver.data.locked && (currentReceiverAmmo < module.maxReceiverAmmo)) //{ // shellReceiver.data.locked = false; //} if (roundChambered) { if (roundSpent) { FrameworkCore.ShootProjectile(item, module.shellID, shellEjectionPoint, null, module.shellEjectionForce, 1.0f, false, slideCapsuleStabilizer); } else { FrameworkCore.ShootProjectile(item, module.ammoID, shellEjectionPoint, null, module.shellEjectionForce, 1.0f, false, slideCapsuleStabilizer); } roundChambered = false; slideController.ChamberRoundVisible(false); } if (CountAmmoFromReceiver() > 0) { chamberRoundOnNext = true; } } } } if ((slideObject.transform.localPosition.z > (PULL_THRESHOLD - RACK_THRESHOLD)) && isPulledBack) { if (CountAmmoFromReceiver() > 0) { slideController.ChamberRoundVisible(true); } } if ((slideObject.transform.localPosition.z >= RACK_THRESHOLD) && !isRacked) { //currentSlideState = true; isRacked = true; isPulledBack = false; shellReceiver.data.disableTouch = true; slideController.ForwardState(); FrameworkCore.Animate(Animations, module.closeAnimationRef); if (playSoundOnNext) { if (rackforwardSound != null) { rackforwardSound.Play(); } playSoundOnNext = false; } if (chamberRoundOnNext) { if (!ConsumeOneFromReceiver()) { return; } slideController.ChamberRoundVisible(true); chamberRoundOnNext = false; roundChambered = true; roundSpent = false; } } if (slideController != null) { slideController.FixCustomComponents(); } else { return; } if (slideController.initialCheck) { return; } try { if (gunGripHeldRight || gunGripHeldLeft) { slideController.UnlockSlide(); slideController.initialCheck = true; } } catch { Debug.Log("[ModularFirearmsFramework] Slide EXCEPTION"); } }