Exemple #1
0
    void SelectWeapon()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            if (i == selectedWeapon)
            {
                transform.GetChild(i).gameObject.SetActive(true);
                BaseWeaponFire weaponFire = transform.GetChild(i).gameObject.GetComponentInChildren <BaseWeaponFire>();

                if (weaponFire != null)
                {
                    ammoManager.SetSelected(weaponFire.ammoType);
                }
                else
                {
                    Debug.LogWarning("Unable to retireve BaseWeaponFire from gameobject " + transform.GetChild(i).gameObject.name);
                }
            }
            else
            {
                transform.GetChild(i).gameObject.SetActive(false);
            }
        }
    }