コード例 #1
0
    internal void Equip(int index)
    {
        DeactivateWeaopns();
        canfire      = true;
        canSwitch    = true;
        activeWeapon = weapons[index];
        activeWeapon.Equip();
        for (int i = 0; i < weapons.Length; i++)
        {
            weapons[i].gameObject.SetActive(true);
        }

        if (weapons[index].name == "Sword")
        {
            swordIcon.SetActive(true);
            gunIcon.SetActive(false);
        }
        if (weapons[index].name == "Hand Gun")
        {
            gunIcon.SetActive(true);
            swordIcon.SetActive(false);
        }
        Reload reloader          = weapons[index].GetComponent <Reload>();
        int    amountInInventory = reloader.roundsRemainingInInventory;
        int    amountInClip      = reloader.roundsRemainingInClip;

        ammoUI.text.text = string.Format("{0}/{1}", amountInClip, amountInInventory);
    }