public void OnBulletFire(PlayerWeaponController controller, WeaponSideCmd cmd) { // DebugUtil.MyLog("[seq:{1}]MuzzleP3Position:{0}",controller.RelatedFirePos.MuzzleP3Position,cmd.UserCmd.Seq); var bulletCfg = controller.HeldWeaponAgent.BulletCfg; AssertUtility.Assert(bulletCfg != null); var cmdSeq = cmd.UserCmd.Seq; var fireAmmu = controller.RelatedCameraSNew.IsAiming() ? sightFireAmmu : normalFireAmmu; // 射出子弹 for (int i = 0; i < bulletCfg.HitCount; i++) { var bulletData = PlayerBulletData.Allocate(); bulletData.Dir = PrecisionsVector3.MakePrecisionsV( fireAmmu.GetFireDir(cmdSeq + i, controller, cmd.UserCmd.Seq), 3); var viewPos = PrecisionsVector3.MakePrecisionsV(fireAmmu.GetFireViewPosition(controller), 3); bulletData.ViewPosition = PrecisionsVector3.MakeRoundPrecisionsV(viewPos, 3); //枪口位置取原始精度 bulletData.EmitPosition = fireAmmu.GetFireEmitPosition(controller); controller.AddAuxBullet(bulletData); // DebugUtil.AppendShootText(cmd.UserCmd.Seq, "[Bullet Fire]{0}", bulletData.ToStringExt()); } controller.AfterAttack(); }
public void OnBulletFire(PlayerWeaponController controller, WeaponSideCmd cmd) { var bulletCfg = controller.HeldWeaponAgent.BulletCfg; AssertUtility.Assert(bulletCfg != null); var cmdSeq = cmd.UserCmd.Seq; var runTimeComponent = controller.HeldWeaponAgent.RunTimeComponent; _bulletInfoProvider.Prepare(controller); // 射出子弹 for (int i = 0; i < bulletCfg.HitCount; i++) { var bulletData = PlayerBulletData.Allocate(); bulletData.Dir = _bulletInfoProvider.GetFireDir(cmdSeq + i, controller); runTimeComponent.LastBulletDir = bulletData.Dir; bulletData.ViewPosition = _bulletInfoProvider.GetFireViewPosition(controller); bulletData.EmitPosition = _bulletInfoProvider.GetFireEmitPosition(controller); controller.AddAuxBullet(bulletData); } controller.AfterAttack(); }