protected virtual void CreateFireRelatedEffect(WeaponAttackProxy attackProxy, ICharacterBone bones) { if (DefaultCfg.Spark < 1) { return; } var muzzleTrans = bones.GetLocation(SpecialLocation.MuzzleEffectPosition, attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson); var ejectTrans = bones.GetLocation(SpecialLocation.EjectionLocation, attackProxy.Appearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson); bool hasMuzzleEfc = muzzleTrans && DefaultCfg.Spark > 0 && attackProxy.Owner.HeldWeaponAgent.HasSpark; bool hasBulletDrop = ejectTrans && DefaultCfg.BulletDrop > 0; if (hasMuzzleEfc) { ClientEffectFactory.CreateMuzzleSparkEffct(muzzleTrans.position, attackProxy.Orientation.Yaw, attackProxy.Orientation.Pitch, DefaultCfg.Spark, muzzleTrans); } if (hasBulletDrop) { ClientEffectFactory.CreateBulletDrop(ejectTrans.position, attackProxy.Orientation.Yaw, attackProxy.Orientation.Pitch, DefaultCfg.BulletDrop, attackProxy.WeaponConfigAssy.S_Id, attackProxy.AudioController.GetFootMatType()); } }
/// <summary> /// </summary> /// <param name="contexts"></param> /// <param name="entity"></param> /// <param name="e"></param> public override void DoEventClient(IContexts contexts, IEntity entity, IEvent e) { FireEvent evt = e as FireEvent; if (evt != null) { var effectCfg = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(evt.weaponId) .S_EffectConfig as DefaultWeaponEffectConfig; if (effectCfg == null) { return; } Contexts ctx = contexts as Contexts; PlayerEntity player = ctx.player.GetEntityWithEntityKey(evt.owner); if (evt.fireEffectType != FireEvent.FireEffectType.EnjectOnly) { var muzzleTrans = player.characterBoneInterface.CharacterBone.GetLocation(SpecialLocation.MuzzleEffectPosition, CharacterView.ThirdPerson); if (muzzleTrans) { ClientEffectFactory.CreateMuzzleSparkEffct(muzzleTrans.position, evt.pitch, evt.yaw, effectCfg.Spark, muzzleTrans); } } if (evt.fireEffectType != FireEvent.FireEffectType.MuzzleOnly) { var ejectTrans = player.characterBoneInterface.CharacterBone.GetLocation(SpecialLocation.EjectionLocation, CharacterView.ThirdPerson); if (ejectTrans) { ClientEffectFactory.CreateBulletDrop(ejectTrans.position, evt.yaw, evt.pitch, effectCfg.BulletDrop, evt.weaponId, AudioGrp_FootMatType.Concrete); } } // var weaponGo = (entity as PlayerEntity).appearanceInterface.Appearance.GetWeaponP1InHand(); // GameAudioMedia.PlayWeaponFireAudio(evt.fireWeaponId, evt.audioFirePos, (AudioGrp_ShotMode)evt.audioFireMode); } // GameAudioMedium.ProcessWeaponAudio(playerEntity,allContexts,(item)=>item.Fire); // if (playerEntity.appearanceInterface.Appearance.IsFirstPerson) // { // } // else // { //// GameAudioMedium.PerformOnGunFire(); // } }
public void PlayMuzzleSparkEffect(PlayerWeaponController controller) { if (null == controller) { Logger.Error("player state owner is not player or null !"); return; } var muzzleTrans = controller.RelatedBones.GetLocation(SpecialLocation.MuzzleEffectPosition, controller.RelatedAppearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson); if (null != muzzleTrans) { ClientEffectFactory.CreateMuzzleSparkEffct(_context, _idGenerator, controller.Owner, muzzleTrans, controller.RelatedOrient.Pitch, controller.RelatedOrient.Yaw, _config.Spark); } else { Logger.Error("Get muzzleLocation location failed"); } }
private void CreateMuzzleSparkEffect(PlayerWeaponController controller) { if (null == controller || DefaultCfg.Spark < 1) { return; } var muzzleTrans = controller.RelatedBones.GetLocation(SpecialLocation.MuzzleEffectPosition, controller.RelatedAppearence.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson); if (null != muzzleTrans) { // Logger.Info("CreateMuzzleSparkEffct Once"); ClientEffectFactory.CreateMuzzleSparkEffct(_context, _idGenerator, controller.Owner, muzzleTrans, controller.RelatedOrientation.Pitch, controller.RelatedOrientation.Yaw, DefaultCfg.Spark); } else { Logger.Error("Get muzzleLocation location failed"); } }
public void PlayMuzzleSparkEffect(IPlayerWeaponState playerState) { var player = playerState.Owner as PlayerEntity; if (null == player) { Logger.Error("player state owner is not player or null !"); return; } var appearance = player.appearanceInterface.Appearance; var characterBone = player.characterBoneInterface.CharacterBone; var owner = player.entityKey.Value; var muzzleTrans = characterBone.GetLocation(SpecialLocation.MuzzleEffectPosition, appearance.IsFirstPerson ? CharacterView.FirstPerson : CharacterView.ThirdPerson); if (null != muzzleTrans) { ClientEffectFactory.CreateMuzzleSparkEffct(_context, _idGenerator, owner, muzzleTrans, playerState.ViewPitch, playerState.ViewYaw, _config.Spark); } else { Logger.Error("Get muzzleLocation location failed"); } }