Esempio n. 1
0
    void OnTriggerEnter(Collider other)
    {
        WeaponPickUp _PickUp = GetComponentInChildren <WeaponPickUp>();

        if (_PickUp != null)
        {
            //PartManager _PartManager = other.GetComponentInChildren<PartManager>();
            PartManager _PartManager = other.GetComponentInParent <PartManager>();
            if (_PartManager != null)
            {
                switch (_PickUp.m_Type)
                {
                case WeaponPickUp.PickUpType.Barrel:
                    _PartManager.AddBarrel(_PickUp.m_BarrelAttributes.m_Index);
                    Mesh.enabled = false;
                    aSource.PlayOneShot(aClip);
                    break;

                case WeaponPickUp.PickUpType.Stock:
                    _PartManager.AddStock(_PickUp.m_StockAttributes.m_Index);
                    Mesh.enabled = false;
                    aSource.PlayOneShot(aClip);
                    break;

                default:
                    break;
                }

                StartCoroutine(Vanish());
            }
        }
    }