示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     text = GetComponent <Text>();
     if (slotToDisplay.transform.childCount >= 1)
     {
         slot = slotToDisplay.transform.GetChild(0).GetComponent <LoadoutWeaponSlot>();
     }
 }
示例#2
0
    public void SwapWithOtherSlot(LoadoutWeaponSlot slot)
    {
        Transform temp = slot.transform.parent;

        slot.transform.SetParent(this.transform.parent);
        this.transform.SetParent(temp);
        slot.transform.localPosition = Vector3.zero;
        this.transform.localPosition = Vector3.zero;
    }
示例#3
0
 public void UpdateText()
 {
     if (slotToDisplay.transform.childCount >= 1)
     {
         slot = slotToDisplay.transform.GetChild(0).GetComponent <LoadoutWeaponSlot>();
     }
     if (slot != null)
     {
         if (slot.weaponToDisplay.GetComponent <ReloadableGun>())
         {
             string temp = "\n-------------\n";
             if (slot.weaponToDisplay.GetComponent <ReloadableGun>().currentEffect != "NoEffect")
             {
                 temp = "\n" + slot.weaponToDisplay.GetComponent <ReloadableGun>().currentEffect + " bullets\n";
             }
             text.text =
                 "" + slot.name + temp +
                 slot.weaponToDisplay.GetComponent <ReloadableGun>().GetCurrentClipSize() +
                 " / " + slot.weaponToDisplay.GetComponent <ReloadableGun>().GetCurrentAmmoStored();
         }
         else if (slot.weaponToDisplay != null)
         {
             text.text = slot.name;
         }
         else
         {
             text.text = "";
         }
     }
     else
     {
         if (slotToDisplay.transform.childCount >= 1)
         {
             slot = slotToDisplay.transform.GetChild(0).GetComponent <LoadoutWeaponSlot>();
         }
         if (text != null)
         {
             text.text = "";
         }
     }
 }