Esempio n. 1
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 DoThrowing(IPlayerWeaponState playerWeapon, IWeaponCmd cmd)
 {
     if (playerWeapon.ThrowingActionInfo.IsReady && !playerWeapon.ThrowingActionInfo.IsThrow)
     {
         if (!playerWeapon.ThrowingActionInfo.IsPull)
         {
             DoPull(playerWeapon, cmd);
         }
         playerWeapon.ThrowingActionInfo.IsThrow         = true;
         playerWeapon.ThrowingActionInfo.ShowCountdownUI = false;
         //投掷时间
         playerWeapon.ThrowingActionInfo.LastFireTime = playerWeapon.ClientTime;
         _throwingFactory.UpdateThrowing(playerWeapon.ThrowingActionInfo.ThrowingEntityKey, true, GetInitVel(playerWeapon));
         //投掷动作
         playerWeapon.StartThrowing();
         //状态重置
         playerWeapon.IsThrowingStartFly = false;
         //投掷型物品使用数量
         playerWeapon.OnGrenadeThrowingOnce();
     }
 }
Esempio n. 3
0
 //投掷
 private void DoThrowing(PlayerWeaponController controller, IWeaponCmd cmd)
 {
     if (controller.RelatedThrowActionInfo.IsReady && !controller.RelatedThrowActionInfo.IsThrow)
     {
         if (!controller.RelatedThrowActionInfo.IsPull)
         {
             DoPull(controller, cmd);
         }
         controller.RelatedThrowActionInfo.IsThrow         = true;
         controller.RelatedThrowActionInfo.ShowCountdownUI = false;
         //投掷时间
         controller.RelatedThrowActionInfo.LastFireTime = controller.RelatedTime.ClientTime;
         _throwingFactory.UpdateThrowing(controller.RelatedThrowActionInfo.ThrowingEntityKey, true, GetInitVel(controller));
         //投掷动作
         controller.RelatedStateInterface.FinishGrenadeThrow();
         //状态重置
         if (controller.RelatedThrowUpdate != null)
         {
             controller.RelatedThrowUpdate.IsStartFly = false;
         }
         //投掷型物品使用数量
         controller.RelatedStatics.UseThrowingCount++;
     }
 }