public override void ExecuteAction(GameObject other) { CollectedItemData cid = other.GetComponent <CollectedItemData>(); if (cid != null && this.gameObject.activeSelf) { cid.addItem(this); this.gameObject.SetActive(false); } }
public void AddItem(CollectedItem item) { CollectedItemData itemData = item.Data; itemData.UiElementRef = Instantiate(LayoutElementFab, UIInventoryItemsLayoutGroup.transform); itemData.UiElementRef.GetComponent <Image>().sprite = itemData.Icon; InventoryList.Add(itemData); _pickUpSound.PlayOneShot(_pickUpSound.clip); }
public override bool isConditionFullfilled(GameObject gameObject) { CollectedItemData ci = gameObject.GetComponent <CollectedItemData> (); return(ci != null && ci.hasItems(collectedItems)); }