예제 #1
0
 public int GetReservedBullet(EWeaponSlotType slot)
 {
     if (slot.IsSlotWithBullet())
     {
         return(controller.GetReservedBullet(slot));
     }
     return(0);
 }
예제 #2
0
        private void DoRealod(PlayerEntity playerEntity, PlayerWeaponController controller, int target)
        {
            //PlayerWeaponController controller = playerEntity.WeaponController();
            //var configAssy = controller.HeldWeaponLogicConfigAssy;
            var cfg = controller.HeldWeaponAgent.CommonFireCfg;
            var lastReservedBullet = controller.GetReservedBullet();

            target = Mathf.Min(target, lastReservedBullet);
            controller.HeldWeaponAgent.BaseComponent.Bullet           += target;
            controller.HeldWeaponAgent.RunTimeComponent.PullBoltFinish = true;
            //DebugUtil.MyLog("Bullet reload" + controller.HeldWeaponAgent.BaseComponent.Bullet, DebugUtil.DebugColor.Black);
            controller.SetReservedBullet(lastReservedBullet - target);

            IEventArgs args = (IEventArgs)(_sessonObjects).FreeArgs;

            if (!args.Triggers.IsEmpty((int)EGameEvent.WeaponState))
            {
                //TODO Implement
                SimpleParaList dama = new SimpleParaList();
                //    dama.AddFields(new ObjectFields(weaponState));
                dama.AddPara(new IntPara("CarryClip", lastReservedBullet - target));
                dama.AddPara(new IntPara("Clip", controller.HeldWeaponAgent.BaseComponent.Bullet));
                dama.AddPara(new IntPara("ClipType", (int)controller.HeldWeaponAgent.Caliber));
                dama.AddPara(new IntPara("id", (int)controller.HeldConfigId));
                SimpleParable sp = new SimpleParable(dama);
                dama.AddFields(new ObjectFields(playerEntity));
                args.Trigger((int)EGameEvent.WeaponState,
                             new TempUnit[]
                {
                    new TempUnit("state", sp), new TempUnit("current", (FreeData)playerEntity.freeData.FreeData)
                });
            }
        }