private void StartMeleeAttack(PlayerWeaponController controller, int attackTime, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { controller.CreateSetMeleeAttackInfo(attackInfo, config); controller.CreateSetMeleeAttackInfoSync(attackTime); controller.AudioController.PlayMeleeAttackAudio(controller.HeldConfigId, (int)attackInfo.AttackType); }
public void CreateSetMeleeAttackInfo(MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { if (entity.hasMeleeAttackInfo) { RelatedMeleeAttackInfo = attackInfo; RelatedMeleeAttackInfoCfg = config; } else { entity.AddMeleeAttackInfo(); RelatedMeleeAttackInfo = attackInfo; RelatedMeleeAttackInfoCfg = config; } }
public void CreateSetMeleeAttackInfo(MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { if (entity.hasMeleeAttackInfo) { entity.meleeAttackInfo.AttackInfo = attackInfo; entity.meleeAttackInfo.AttackConfig = config; } else { entity.AddMeleeAttackInfo(); entity.meleeAttackInfo.AttackInfo = attackInfo; entity.meleeAttackInfo.AttackConfig = config; } }
public static float GetPlayerFactor(RaycastHit hit, MeleeFireLogicConfig config, EBodyPart part) { var factor = 1f; for (int i = 0; i < config.DamageFactor.Length; i++) { if (config.DamageFactor[i].BodyPart == part) { factor = config.DamageFactor[i].Factor; break; } } return(factor); }
private float GetPlayerFactor(RaycastHit hit, MeleeFireLogicConfig config) { Collider collider = hit.collider; EBodyPart part = BulletPlayerUtility.GetBodyPartByHitBoxName(collider); var factor = 1f; for (int i = 0; i < config.DamageFactor.Length; i++) { if (config.DamageFactor[i].BodyPart == part) { factor = config.DamageFactor[i].Factor; break; } } return(factor); }
public void OnHitEnvrionment(Contexts contexts, PlayerEntity src, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { var heldConfigId = src.WeaponController().HeldConfigId; RaycastHit effectHit; bool showAttackEffect = (MeleeHitUtil.CanMeleeAttackShowHit(src, out effectHit, config.Range)); var collider = effectHit.collider != null ? effectHit.collider : hit.collider; FracturedHittable fracturedHittable = collider.GetComponent <FracturedHittable>(); FracturedAbstractChunk fracturedChunk = HitFracturedHandler.HitFracturedObj(src, effectHit, fracturedHittable); var hasHole = fracturedChunk == null || (fracturedChunk.HasBulletHole && !fracturedChunk.IsBroken()); if (showAttackEffect && hasHole) { int audioId = SingletonManager.Get <AudioWeaponManager>().FindById(heldConfigId).HitList.Body; ClientEffectFactory.AdHitEnvironmentEffectEvent(src, effectHit.point, effectHit.normal, EEnvironmentType.Wood, audioId, 0, heldConfigId != WeaponUtil.EmptyHandId); } }
public void OnHitVehicle(Contexts contexts, PlayerEntity src, VehicleEntity target, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { VehiclePartIndex partIndex; var baseDamage = MeleeHitUtil.GetVehicleFactor(hit, target, out partIndex) * MeleeHitUtil.GetBaseDamage(attackInfo, config); var gameData = target.GetGameData(); gameData.DecreaseHp(partIndex, baseDamage); if (!src.WeaponController().IsHeldSlotEmpty) { RaycastHit effectHit; if (MeleeHitUtil.CanMeleeAttackShowHit(src, out effectHit, config.Range)) { ClientEffectFactory.AddHitVehicleEffectEvent(src, target.entityKey.Value, effectHit.point, effectHit.point - target.position.Value, effectHit.normal); } } }
public void OnHitPlayer(Contexts contexts, PlayerEntity src, PlayerEntity target, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config, int seq) { EBodyPart part = BulletPlayerUtil.GetBodyPartByHitBoxName(hit.collider); var baseDamage = MeleeHitUtil.GetPlayerFactor(hit, config, part) * MeleeHitUtil.GetBaseDamage(attackInfo, config); if (src.hasStatisticsData) { src.statisticsData.Statistics.AttackType = (int)attackInfo.AttackType; } //有效命中 /*if (target.gamePlay.IsLastLifeState(EPlayerLifeState.Alive)) * { * src.statisticsData.Statistics.ShootingPlayerCount++; * }*/ var playerWeaponId = src.WeaponController().HeldConfigId; WeaponResConfigItem newConfig = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(playerWeaponId); EUIDeadType euiDeadType = (null != newConfig && newConfig.SubType == (int)EWeaponSubType.Hand) ? EUIDeadType.Unarmed : EUIDeadType.Weapon; BulletPlayerUtil.ProcessPlayerHealthDamage(contexts, _damager, src, target, new PlayerDamageInfo(Mathf.CeilToInt(baseDamage), (int)euiDeadType, (int)part, src.WeaponController().HeldWeaponAgent.ConfigId, false, false, false, hit.point, target.position.Value - src.position.Value)); // Logger.InfoFormat("[Hit] process damage sucess,dvalue:{0}", baseDamage); //由于动画放在客户端做了,服务器调用的命令会被忽视,需要发送事件到客户端 // if (target.hasStateInterface && target.stateInterface.State.CanBeenHit()) // { // target.stateInterface.State.BeenHit(); // } ClientEffectFactory.AddBeenHitEvent(src, target, AttackUtil.GeneraterUniqueHitId(src, seq), contexts.session.currentTimeObject.CurrentTime); int audioId = SingletonManager.Get <AudioWeaponManager>().FindById(playerWeaponId).HitList.Body; ClientEffectFactory.AddHitPlayerEffectEvent(src, target.entityKey.Value, hit.point, audioId, part); }
public static float GetBaseDamage(MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { var damage = 0; switch (attackInfo.AttackType) { case EMeleeAttackType.Soft: damage = config.LeftDamage; break; case EMeleeAttackType.Hard: damage = config.RightDamage; break; default: MeleeAttackSystem.Logger.ErrorFormat("[HitErr]Melee AttackType {0} is illegal ", attackInfo.AttackType); break; } return(damage); }
private float GetBaseDamage(MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { var damage = 0; switch (attackInfo.AttackType) { case MeleeAttckType.LeftMeleeAttack: damage = config.LeftDamage; break; case MeleeAttckType.RightMeleeAttack: damage = config.RightDamage; break; default: damage = 1; Logger.ErrorFormat("AttackType {0} is illegal ", attackInfo.AttackType); break; } return(damage); }
public void StartMeleeAttack(int attackTime, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { if (_playerEntity.hasMeleeAttackInfoSync) { _playerEntity.meleeAttackInfoSync.AttackTime = attackTime; } else { _playerEntity.AddMeleeAttackInfoSync(attackTime); } if (_playerEntity.hasMeleeAttackInfo) { _playerEntity.meleeAttackInfo.AttackInfo = attackInfo; _playerEntity.meleeAttackInfo.AttackConfig = config; } else { _playerEntity.AddMeleeAttackInfo(); _playerEntity.meleeAttackInfo.AttackInfo = attackInfo; _playerEntity.meleeAttackInfo.AttackConfig = config; } }
public void OnHitVehicle(PlayerEntity src, VehicleEntity target, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { DebugDraw.DebugPoint(hit.point, color: Color.yellow, duration: 10); }
public void CreateSetMeleeAttackInfo(MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { RelatedMeleeAttackInfo = attackInfo; RelatedMeleeAttackInfoCfg = config; }
public void OnHitEnvrionment(PlayerEntity src, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { if (!src.weaponLogic.Weapon.EmptyHand) { RaycastHit effectHit; if (TryGetEffectShowHit(src, out effectHit, config.Range)) { ClientEffectFactory.AdHitEnvironmentEffectEvent(src, effectHit.point, effectHit.normal, EEnvironmentType.Wood); } } }
public void OnHitEnvrionment(PlayerEntity src, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { DebugDraw.DebugPoint(hit.point, color: Color.blue, duration: 10); }
public void OnHitVehicle(PlayerEntity src, VehicleEntity target, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { VehiclePartIndex partIndex; var baseDamage = GetVehicleFactor(hit, target, out partIndex) * GetBaseDamage(attackInfo, config); var gameData = target.GetGameData(); gameData.DecreaseHp(partIndex, baseDamage); if (!src.weaponLogic.Weapon.EmptyHand) { RaycastHit effectHit; if (TryGetEffectShowHit(src, out effectHit, config.Range)) { ClientEffectFactory.AddHitVehicleEffectEvent( src, target.entityKey.Value, effectHit.point, effectHit.point - target.position.Value, effectHit.normal); } } }
public void OnHitPlayer(PlayerEntity src, PlayerEntity target, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { var baseDamage = GetPlayerFactor(hit, config) * GetBaseDamage(attackInfo, config); Collider collider = hit.collider; EBodyPart part = BulletPlayerUtility.GetBodyPartByHitBoxName(collider); //有效命中 if (target.gamePlay.IsLastLifeState(EPlayerLifeState.Alive)) { src.statisticsData.Statistics.ShootingPlayerCount++; } NewWeaponConfigItem newConfig = SingletonManager.Get <WeaponConfigManager>().GetConfigById(src.weaponLogicInfo.WeaponId); if (null != newConfig && newConfig.SubType == (int)EWeaponSubType.Hand) { BulletPlayerUtility.ProcessPlayerHealthDamage(_damager, src, target, new PlayerDamageInfo(Mathf.CeilToInt(baseDamage), (int)EUIDeadType.Unarmed, (int)part, 0), _damageInfoCollector); } else { BulletPlayerUtility.ProcessPlayerHealthDamage(_damager, src, target, new PlayerDamageInfo(Mathf.CeilToInt(baseDamage), (int)EUIDeadType.Weapon, (int)part, src.weaponLogicInfo.WeaponId), _damageInfoCollector); } if (target.hasStateInterface && target.stateInterface.State.CanBeenHit()) { target.stateInterface.State.BeenHit(); } ClientEffectFactory.AddHitPlayerEffectEvent(src, target.entityKey.Value, hit.point, hit.point - target.position.Value); }
public void OnHitPlayer(Contexts contexts, PlayerEntity src, PlayerEntity target, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config, int seq) { var baseDamage = GetPlayerFactor(hit, config) * GetBaseDamage(attackInfo, config); Collider collider = hit.collider; EBodyPart part = BulletPlayerUtility.GetBodyPartByHitBoxName(collider); //有效命中 /*if (target.gamePlay.IsLastLifeState(EPlayerLifeState.Alive)) * { * src.statisticsData.Statistics.ShootingPlayerCount++; * }*/ WeaponResConfigItem newConfig = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(src.WeaponController().HeldWeaponAgent.ConfigId); if (null != newConfig && newConfig.SubType == (int)EWeaponSubType.Hand) { BulletPlayerUtility.ProcessPlayerHealthDamage(contexts, _damager, src, target, new PlayerDamageInfo(Mathf.CeilToInt(baseDamage), (int)EUIDeadType.Unarmed, (int)part, 0), _damageInfoCollector); } else { BulletPlayerUtility.ProcessPlayerHealthDamage(contexts, _damager, src, target, new PlayerDamageInfo(Mathf.CeilToInt(baseDamage), (int)EUIDeadType.Weapon, (int)part, src.WeaponController().HeldWeaponAgent.ConfigId), _damageInfoCollector); } //由于动画放在客户端做了,服务器调用的命令会被忽视,需要发送事件到客户端 // if (target.hasStateInterface && target.stateInterface.State.CanBeenHit()) // { // target.stateInterface.State.BeenHit(); // } ClientEffectFactory.AddBeenHitEvent(src, target.entityKey.Value, BulletHitHandler.GeneraterUniqueHitId(src, seq), contexts.session.currentTimeObject.CurrentTime); ClientEffectFactory.AddHitPlayerEffectEvent(src, target.entityKey.Value, hit.point, hit.point - target.position.Value); }
public void OnHitEnvrionment(Contexts contexts, PlayerEntity src, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { if (!src.WeaponController().IsHeldSlotEmpty) { RaycastHit effectHit; if (TryGetEffectShowHit(src, out effectHit, config.Range)) { ClientEffectFactory.AdHitEnvironmentEffectEvent(src, effectHit.point, effectHit.normal, EEnvironmentType.Wood); } } }
public void OnHitPlayer(Contexts contexts, PlayerEntity src, PlayerEntity target, RaycastHit hit, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config, int seq) { DebugDraw.DebugPoint(hit.point, color: Color.red, duration: 10); }
public MeleeWeaponFireController(MeleeFireLogicConfig config) { _config = config; }
public MeleeFireLogic(MeleeFireLogicConfig config) { _config = config; }
private void StartMeleeAttack(PlayerWeaponController controller, int attackTime, MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { controller.CreateSetMeleeAttackInfo(attackInfo, config); controller.CreateSetMeleeAttackInfoSync(attackTime); }
public void CreateSetMeleeAttackInfo(MeleeAttackInfo attackInfo, MeleeFireLogicConfig config) { weaponInteract.CreateSetMeleeAttackInfo(attackInfo, config); }