public void Cycle() { if (collection.data.Count >= 1) { selectorIndex++; if (selectorIndex > collection.data.Count) { selectorIndex = 1; } GameObject obj = collection.GetDataItem(selectorIndex - 1);//data [i]; if (obj.GetComponent <isUsable>() != null) { isUsable iu = obj.GetComponent <isUsable>(); // fix disabled object sendmessage failure! if (obj != null) { obj.SetActive(true); //obj.GetComponent<isHurtBox>().equipped = true; } iu.Use(); } isInventoryViewUpdate(); } }
public GameObject obj; // object back prt to collection public void OnMouseDown() { isUsable iu = obj.GetComponent <isUsable> (); if (iu != null) { // fix disabled object sendmessage failure! if (obj != null) { obj.SetActive(true); } iu.Use(); } }