Esempio n. 1
0
    // SWITCHES WEAPONS BY WEAPON TAG
    public void SwitchWeapon(string weaponTag)
    {
        GameObject tempWeapon;

        foreach (Transform child in gunCam.transform)
        {
            if (child.gameObject.tag.Equals(weaponTag))
            {
                tempWeapon = child.gameObject;
                if (tempWeapon.GetComponent <WeaponStats>().IsWeaponPickedUp() == true)
                {
                    if (tempWeapon.GetComponent <WeaponStats>().IsWeaponActive() != true)
                    {
                        ChangeActiveWeapon(tempWeapon);
                        string weaponName = tempWeapon.GetComponent <WeaponStats>().GetWeaponName();
                        WeaponStats.FindAmmoType(weaponName);
                        weaponSwitch = true;
                    }
                }
            }
        }
    }