コード例 #1
0
 /// <summary>Changes the selected weapon to the new one(only used by local player).</summary>
 /// <param name="_index">The index of the weapon to change in the inventory.</param>
 public void SelectWeapon(int _index)
 {
     if (InventoryWeapons[_index] != null)
     {
         if (InventoryWeapons[_index] != selectedWeapon)
         {
             ClientSend.ChangeWeapon(_index);
             if (selectedWeapon)
             {
                 DeselectWeaponImage(InventoryHudSlots[GetWeaponIndex(selectedWeapon)]);
                 selectedWeapon.SetActive(false);
             }
             selectedWeapon = InventoryWeapons[_index];
             SelectWeaponImage(InventoryHudSlots[GetWeaponIndex(selectedWeapon)]);
             selectedWeapon.SetActive(true);
         }
     }
 }