// PRIVATE METHODS: ---------------------------------------------------- private void ShootGeneric(CharacterShooter shooter, float deviation, CharacterShooter.ShotType shotType) { shooter.UpdateShootFireRate(this.ammoID); shooter.PlayAudio(this.audioShoot); if (this.animationShoot && shooter.animator != null) { shooter.animator.CrossFadeGesture( this.animationShoot, 1f, this.maskShoot, 0.05f, 0.2f ); } if (this.prefabMuzzleFlash) { GameObject muzzleInstance = PoolManager.Instance.Pick(this.prefabMuzzleFlash); muzzleInstance.transform.SetPositionAndRotation( shooter.muzzle.GetPosition(), shooter.muzzle.GetRotation() ); } if (this.delay < 0.01f) { this.ShootSelection(shooter, deviation, shotType); } else { CoroutinesManager.Instance.StartCoroutine( this.ShootSelectionDelayed(shooter, deviation, shotType) ); } }
public IEnumerator Reload(CharacterShooter shooter) { WaitForSeconds wait = new WaitForSeconds(this.reloadDuration / 2f); if (shooter.animator && this.animationReload) { float speed = this.animationReload.length / this.reloadDuration; shooter.animator.CrossFadeGesture( this.animationReload, speed, this.maskReload, 0.2f, 0.2f ); } if (shooter.aimIK) { shooter.aimIK.SetStability( shooter.currentWeapon.aiming.stabilizeBody, 0.1f ); } shooter.PlayAudio(this.audioReload); yield return(wait); this.AddAmmoPrefab(shooter); if (shooter.aimIK) { shooter.aimIK.SetStability(false); } shooter.eventReload.Invoke(shooter.currentWeapon, this); yield return(wait); }
private bool ClipRequirements(CharacterShooter shooter, bool subtract) { if (shooter.GetAmmoInClip(this.ammoID) > 0) { if (subtract) { shooter.AddAmmoToClip(this.ammoID, -1); } return(true); } if (shooter.GetAmmoInStorage(this.ammoID) > 0 && this.autoReload) { shooter.StartCoroutine(shooter.Reload()); } else { shooter.PlayAudio(this.audioEmpty); } return(false); }