/// <summary> /// 玩家武器背包添加 /// </summary> /// <param name="player"></param> public static void AttachPlayerWeaponBags(this PlayerEntity player) { if (!player.hasPlayerWeaponBagSet) { player.AddPlayerWeaponBagSet(WeaponUtil.CreateEmptyBagContainers()); } }
public static void AttachGrenadeCacheData(this PlayerEntity player, List <int> ids) { if (!player.hasGrenadeCacheData) { var arrs = WeaponUtil.CreateEmptyGrenadeCacheArrs(ids); player.AddGrenadeCacheData(arrs); } }
/// <summary> /// 获取手雷信息 /// </summary> /// <param name="player"></param> /// <returns></returns> private static GrenadeCacheDataComponent FindGrenadeCacheData(this PlayerEntity player) { if (!player.hasGrenadeCacheData) { var greandeIds = WeaponUtil.ForeachFilterGreandeIds(); var arrs = WeaponUtil.CreateEmptyGrenadeCacheArrs(greandeIds); player.AddGrenadeCacheData(arrs); } return(player.grenadeCacheData); }
public static void SetHeldSlotIndex(this PlayerWeaponBagSetComponent component, int bagIndex, int nowSlot) { var bag = component[bagIndex]; if (bag.HeldSlotPointer == nowSlot) { return; } if (!WeaponUtil.VertifyEweaponSlotIndex(nowSlot, true)) { return; } bag.ChangeSlotPointer(nowSlot); }
public static EntityKey CreateCustomizeWeapon(EntityKey lastKey, EntityKey owner, int configId) { if (lastKey.IsValid()) { WeaponEntity currWeapon = WeaponEntityFactory.GetWeaponEntity(lastKey); if (currWeapon != null) { WeaponEntityFactory.RemoveWeaponEntity(currWeapon); } } WeaponEntity newWeapon = WeaponEntityFactory.CreateEntity(WeaponUtil.CreateScan(configId)); newWeapon.SetRetain(owner); return(newWeapon.entityKey.Value); }
/// <summary> /// 玩家武器背包添加 /// </summary> /// <param name="player"></param> public static void AttachPlayerWeaponBags(this PlayerEntity player, Contexts context) { var containers = WeaponUtil.CreateEmptyBagContainers(); player.AddPlayerWeaponBagSet(containers); }
public static void SyncSelf(this WeaponObjectComponent weaponSceneObject, WeaponScanStruct weaponInfo) { weaponSceneObject.WeaponKey = WeaponUtil.IsWeaponKeyVaild(weaponInfo.WeaponKey)? weaponInfo.WeaponKey:EntityKey.Default; weaponSceneObject.ConfigId = weaponInfo.ConfigId; }