Beispiel #1
0
        private EBulletCaliber GetCaliber(PlayerWeaponController controller, EWeaponSlotType slot)
        {
            var weapon = controller.GetWeaponAgent(slot);

            if (weapon.ConfigId > 0)
            {
                var cfg = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(weapon.ConfigId);
                return((EBulletCaliber)cfg.Caliber);
            }
            //  Logger.ErrorFormat("no weapon in slot {0} !!", slot);
            return(EBulletCaliber.None);
        }
Beispiel #2
0
        //投掷
        private void DoThrowing(PlayerWeaponController controller, WeaponSideCmd cmd, Contexts contexts)
        {
            if (controller.RelatedThrowAction.IsReady && !controller.RelatedThrowAction.IsThrow)
            {
                if (GlobalConst.EnableWeaponLog)
                {
                    DebugUtil.MyLog("Do Throwing");
                }

                if (!controller.RelatedThrowAction.IsPull)
                {
                    DoPull(controller, cmd);
                }
                controller.RelatedThrowAction.IsThrow         = true;
                controller.RelatedThrowAction.ShowCountdownUI = false;
                //投掷时间
                controller.RelatedThrowAction.LastFireTime = controller.RelatedTime;
                _throwingFactory.UpdateThrowing(controller.RelatedThrowAction.ThrowingEntityKey, true, GetInitVel(controller));
                //投掷动作
                controller.RelatedCharState.FinishGrenadeThrow();
                //状态重置
                if (controller.RelatedThrowUpdate != null)
                {
                    controller.RelatedThrowUpdate.ReadyFly = false;
                }
                //投掷型物品使用数量
                controller.RelatedStatisticsData.UseThrowingCount++;
                if (SharedConfig.IsServer)
                {
                    FreeRuleEventArgs args = contexts.session.commonSession.FreeArgs as FreeRuleEventArgs;
                    (args.Rule as IGameRule).HandleWeaponFire(contexts, contexts.player.GetEntityWithEntityKey(controller.Owner), controller.GetWeaponAgent().ResConfig);
                }
                else
                {
                    if (controller.AudioController != null)
                    {
                        controller.AudioController.PlaySimpleAudio(EAudioUniqueId.GrenadeThrow, true);
                    }
                }
            }
            //controller.RelatedThrowAction.ThrowingEntityKey = EntityKey.Default;
        }
        private void CallBulletFires(PlayerWeaponController controller, WeaponSideCmd cmd, Contexts contexts)
        {
            foreach (var bulletfire in _bulletFires)
            {
                bulletfire.OnBulletFire(controller, cmd);
            }

            if (SharedConfig.IsServer)
            {
                FreeRuleEventArgs args = contexts.session.commonSession.FreeArgs as FreeRuleEventArgs;
                (args.Rule as IGameRule).HandleWeaponFire(contexts, contexts.player.GetEntityWithEntityKey(controller.Owner), controller.GetWeaponAgent().ResConfig);
            }
        }