public void OnFrame(IPlayerWeaponState playerWeapon, IWeaponCmd cmd) { playerWeapon.IsPrevCmdFire = cmd.IsFire; if (cmd.IsSwitchFireMode && cmd.FilteredInput.IsInput(XmlConfig.EPlayerInput.IsSwitchFireMode)) { EFireMode mode = playerWeapon.FireMode; EFireMode nextMode = _config.AvaiableModes[0]; for (int i = 0; i < _config.AvaiableModes.Length; i++) { if (_config.AvaiableModes[i] == mode) { nextMode = _config.AvaiableModes[(i + 1) % _config.AvaiableModes.Length]; } } if (nextMode == mode) { playerWeapon.ShowFireModeUnchangeTip(); } else { playerWeapon.ShowFireModeChangeTip(nextMode); } playerWeapon.FireMode = nextMode; playerWeapon.OnSwitchMode(_common); } }
public virtual bool IsCanFire(WeaponAttackProxy attackProxy, WeaponSideCmd cmd) { if (cmd.UserCmd.RenderTime < attackProxy.RuntimeComponent.NextAttackTimestamp) { return(false); } if (attackProxy.BasicComponent.Bullet <= 0) { attackProxy.Owner.ShowTip(ETipType.FireWithNoBullet); if (cmd.FiltedInput(EPlayerInput.IsLeftAttack)) { attackProxy.AudioController.PlayEmptyFireAudio(); } return(false); } EFireMode currentMode = (EFireMode)attackProxy.BasicComponent.RealFireModel; switch (currentMode) { case EFireMode.Manual: return(!attackProxy.RuntimeComponent.IsPrevCmdFire); case EFireMode.Auto: return(true); case EFireMode.Burst: return(!attackProxy.RuntimeComponent.IsPrevCmdFire || attackProxy.RuntimeComponent.NeedAutoBurstShoot); default: return(false); } }
public void OnFrame(PlayerWeaponController controller, IWeaponCmd cmd) { var heldAgent = controller.HeldWeaponAgent; heldAgent.RunTimeComponent.IsPrevCmdFire = cmd.IsFire; if (cmd.IsSwitchFireMode && cmd.FilteredInput.IsInput(XmlConfig.EPlayerInput.IsSwitchFireMode)) { var config = heldAgent.DefaultFireModeLogicCfg; if (config == null || config == null) { return; } EFireMode mode = (EFireMode)heldAgent.BaseComponent.RealFireModel; EFireMode nextMode = config.AvaliableModes[0]; for (int i = 0; i < config.AvaliableModes.Length; i++) { if (config.AvaliableModes[i] == mode) { nextMode = config.AvaliableModes[(i + 1) % config.AvaliableModes.Length]; } } if (nextMode == mode) { controller.ShowTip(ETipType.FireModeLocked); } else { ShowFireModeChangeTip(controller, nextMode); } heldAgent.BaseComponent.FireModel = (int)nextMode; // controller.AudioController.SwitchFireMode(nextMode); // controller.PlayWeaponSound(XmlConfig.EWeaponSoundType.SwitchFireMode); } }
private void Start() { m_fireMode = EFireMode.WEAK; m_DockRightTriggerScript.FireTriggerEnterEvent += ActivateRightDock; m_DockLeftTriggerScript.FireTriggerEnterEvent += ActivateLeftDock; m_DockRightTriggerScript.FireTriggerExitEvent += DeactivateRightDock; m_DockLeftTriggerScript.FireTriggerExitEvent += DeactivateLeftDock; InvokeRepeating("CheckDocks", 1f, 1f); }
/// <summary> /// 枪械切换 /// </summary> /// <param name="weaponCfg"></param> public static void SwitchFireModelAudio(EFireMode model, GameObject target) { if (SharedConfig.IsServer) return; #if UNITY_EDITOR if (AudioInfluence.IsForbidden) return; #endif AudioGrp_ShotModelIndex shotModelIndex = model.ToAudioGrpIndex(); if (AKAudioEntry.Dispatcher != null) AKAudioEntry.Dispatcher.SetSwitch(target, shotModelIndex); }
public void SetFireMode(EWeaponSlotType slot, EFireMode mode) { var weapon = GetWeaponComponentBySlot(slot); if (WeaponValid(weapon)) { weapon.FireMode = (int)mode; } else { Logger.ErrorFormat("get weapon bolted failed : no weapon in slot {0} ", slot); } }
public static AudioGrp_ShotModelIndex ToAudioGrpIndex(this EFireMode fireModel) { switch (fireModel) { case EFireMode.Auto: return(AudioGrp_ShotModelIndex.Continue); case EFireMode.Burst: return(AudioGrp_ShotModelIndex.Trriple); default: return(AudioGrp_ShotModelIndex.Single); } }
private void ShowFireModeChangeTip(EFireMode newFireMode) { switch (newFireMode) { case EFireMode.Auto: ShowTip(ETipType.FireModeToAuto); break; case EFireMode.Burst: ShowTip(ETipType.FireModeToBurst); break; case EFireMode.Manual: ShowTip(ETipType.FireModeToManual); break; } }
public void ShowFireModeChangeTip(EFireMode newFireMode) { switch (newFireMode) { case EFireMode.Auto: _playerEntity.tip.TipType = ETipType.FireModeToAuto; break; case EFireMode.Burst: _playerEntity.tip.TipType = ETipType.FireModeToBurst; break; case EFireMode.Manual: _playerEntity.tip.TipType = ETipType.FireModeToManual; break; } }
//TODO 提出到System //private void PlaySound(PlayerWeaponController controller) //{ // CommonFireConfig common = GetCommonFireConfig(controller); // if(controller.appearanceInterface.Appearance.IsFirstPerson) // { // Audio.GameAudioMedium.PerformOnGunModelSwitch(common, controller.appearanceInterface.Appearance.GetWeaponP1InHand()); // } // else // { // Audio.GameAudioMedium.PerformOnGunModelSwitch(common, controller.appearanceInterface.Appearance.GetWeaponP3InHand()); // } //} private void ShowFireModeChangeTip(PlayerWeaponController controller, EFireMode newFireMode) { switch (newFireMode) { case EFireMode.Auto: controller.ShowTip(ETipType.FireModeToAuto); break; case EFireMode.Burst: controller.ShowTip(ETipType.FireModeToBurst); break; case EFireMode.Manual: controller.ShowTip(ETipType.FireModeToManual); break; } }
public bool IsCanFire(PlayerWeaponController controller, IWeaponCmd weaponCmd) { WeaponBaseAgent weaponAgent = controller.HeldWeaponAgent; if (weaponCmd.RenderTime < weaponAgent.RunTimeComponent.NextAttackTimestamp) { return(false); } if (weaponAgent.BaseComponent.Bullet <= 0) { controller.ShowTip(ETipType.FireWithNoBullet); return(false); } EFireMode currentMode = (EFireMode)weaponAgent.BaseComponent.RealFireModel; if (currentMode == EFireMode.Manual) { if (weaponAgent.RunTimeComponent.IsPrevCmdFire) { return(false); } else { return(true); } } else if (currentMode == EFireMode.Auto) { return(true); } else if (currentMode == EFireMode.Burst) { return(true); // _config.BurstCount; } else { return(false); } }
public void SwitchFireMode() { if (IsHeldSlotEmpty) { return; } var config = HeldWeaponAgent.DefaultFireModeLogicCfg; if (config == null || config.AvaliableModes == null) { return; } EFireMode mode = (EFireMode)HeldWeaponAgent.BaseComponent.RealFireModel; EFireMode nextMode = config.AvaliableModes[0]; for (int i = 0; i < config.AvaliableModes.Length; i++) { if (config.AvaliableModes[i] == mode) { nextMode = config.AvaliableModes[(i + 1) % config.AvaliableModes.Length]; } } if (nextMode == mode) { ShowTip(ETipType.FireModeLocked); } else { ShowFireModeChangeTip(nextMode); if (AudioController != null) { AudioController.PlaySimpleAudio(EAudioUniqueId.FireMode); } } HeldWeaponAgent.BaseComponent.FireModel = (int)nextMode; }
public int GetFireTimes(IPlayerWeaponState playerWeapon) { if (playerWeapon.ClientTime < playerWeapon.NextAttackTimer) { return(0); } if (playerWeapon.LoadedBulletCount <= 0) { playerWeapon.ShowNoBulletTip(); return(0); } EFireMode currentMode = playerWeapon.FireMode; if (currentMode == EFireMode.Manual) { if (playerWeapon.IsPrevCmdFire) { return(0); } else { return(1); } } else if (currentMode == EFireMode.Auto) { return(1); } else if (currentMode == EFireMode.Burst) { return(1); // _config.BurstCount; } else { return(0); } }
public virtual bool IsCanFire(PlayerWeaponController controller, WeaponSideCmd cmd) { WeaponBaseAgent weaponAgent = controller.HeldWeaponAgent; if (cmd.UserCmd.RenderTime < weaponAgent.RunTimeComponent.NextAttackTimestamp) { return(false); } if (weaponAgent.BaseComponent.Bullet <= 0) { controller.ShowTip(ETipType.FireWithNoBullet); if (cmd.FiltedInput(EPlayerInput.IsLeftAttack) && controller.AudioController != null) { controller.AudioController.PlayEmptyFireAudio(); } return(false); } EFireMode currentMode = (EFireMode)weaponAgent.BaseComponent.RealFireModel; switch (currentMode) { case EFireMode.Manual: return(!weaponAgent.RunTimeComponent.IsPrevCmdFire); case EFireMode.Auto: return(true); case EFireMode.Burst: return(!weaponAgent.RunTimeComponent.IsPrevCmdFire || weaponAgent.RunTimeComponent.NeedAutoBurstShoot); default: return(false); } }
internal static void SetFireMode(this WeaponEntity weapon, EFireMode model) { weapon.weaponBasicData.FireMode = (int)model; }