public void SwitchBag() { if (CanSwitchWeaponBag) { int length = ModeController.GetUsableWeapnBagLength(RelatedPlayerInfo); SwitchBag((HeldBagPointer + 1) % length); } }
public void Initialize(EntityKey owner, PlayerWeaponComponentsAgent agent, PlayerEntityWeaponInteract interact, GrenadeCacheHelper helper) { Owner = owner; grenadeHelper = helper; weaponInteract = interact; playerWeaponAgent = agent; int modeBagLength = ModeController.GetUsableWeapnBagLength(RelatedPlayerInfo); slotWeaponAgents = new WeaponBaseAgent[GlobalConst.WeaponBagMaxCount, GlobalConst.WeaponSlotMaxLength]; var throwWeaponAgent = CreateGetWeaponAgent(0, EWeaponSlotType.ThrowingWeapon); //多个背包共享一份投掷武器代理 if (modeBagLength > 1) { for (int i = 1; i < modeBagLength; i++) { slotWeaponAgents[i, (int)EWeaponSlotType.ThrowingWeapon] = throwWeaponAgent; } } }
private PlayerWeaponBagData FindWeaponBagDataBySlot(int index) { int length = ModeController.GetUsableWeapnBagLength(RelatedPlayerInfo); if (index == HeldBagPointer) { return(null); } List <PlayerWeaponBagData> bagDatas = ModeController.FilterSortedWeaponBagDatas(RelatedPlayerInfo); if (bagDatas == null || bagDatas.Count <= index) { return(null); } PlayerWeaponBagData tarBag = bagDatas.Find(bag => bag.BagIndex == index); if (tarBag == null) { return(null); } HeldBagPointer = index; return(tarBag); }