public bool PullTrigger(float trigger) { if (ammo == 0 && !infiniteAmmo) { return(false); } // sear checks var isCycleDone = autoSear.CanTrip(); var isTriggerUp = sear.Trip(trigger); // cycle rate check if (isCycleDone) { if (automatic && trigger > 0) { // auto TriggerActions(); autoSear.Trip(); ammo = Mathf.Clamp(ammo - 1, 0, magazineCapacity); return(true); } else if (isTriggerUp) { // semi TriggerActions(); autoSear.Trip(); ammo = Mathf.Clamp(ammo - 1, 0, magazineCapacity); return(true); } } // cannot fire return(false); }
void Update() { if (disconnector.Trip(PlayerInput.pause)) { PauseToggle(); } }