public void Add(Item item) { item.SetActive(false); item.DisableRigidBody(); item.transform.parent = Main.Instance.Hand; item.transform.localPosition = Vector3.zero; item.transform.localRotation = Quaternion.Euler(Vector3.zero); if (item is AutoGunClip) { AutoGun a = Find <AutoGun>(); a?.AddClip(item as AutoGunClip); return; } if (item is ShotGunClip) { ShotGun a = Find <ShotGun>(); a?.AddClip(item as ShotGunClip); return; } _items.Add(item); }
void Awake() { autoGun = transform.root.GetComponent <AutoGun>(); }