Beispiel #1
0
        private void DoRealod(PlayerEntity player, 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;
            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);
                args.Trigger((int)EGameEvent.WeaponState, new TempUnit[] { new TempUnit("state", sp), new TempUnit("current", (FreeData)player.freeData.FreeData) });
            }
        }
Beispiel #2
0
 private bool HasNoReservedBullet(PlayerWeaponController controller, PlayerEntity playerEntity)
 {
     if (controller.GetReservedBullet() < 1)
     {
         if (SharedConfig.CurrentGameMode == EGameMode.Normal)
         {
             playerEntity.tip.TipType = ETipType.BulletRunout;
         }
         else
         {
             playerEntity.tip.TipType = ETipType.NoBulletInPackage;
         }
         return(true);
     }
     return(false);
 }