public void ItemDiscard(int i) { // nothing to discard if (CurrentItemsObjects [i].objectImage == null) { return; } int OneTimeDiscard = 3; ItemObjectLogic itemLogic = CurrentItemsObjects [i].itemLogic; Transform tf = transform.Find("Misaki_SchoolUniform_summer"); // discard to the plane and reduce from panel if (CurrentItemsObjects [i].quantity > OneTimeDiscard) { itemLogic.DiscardItem(tf, CurrentItemsObjects [i], OneTimeDiscard); CurrentItemsObjects [i].quantity -= OneTimeDiscard; } else if (CurrentItemsObjects [i].quantity > 0) { itemLogic.DiscardItem(tf, CurrentItemsObjects [i], CurrentItemsObjects [i].quantity); CurrentItemsObjects [i] = ScriptableObject.CreateInstance <ItemObject> (); } else if (CurrentItemsObjects [i].quantity == 0) // uncountable { itemLogic.DiscardItem(tf, CurrentItemsObjects [i]); CurrentItemsObjects [i] = ScriptableObject.CreateInstance <ItemObject> (); } else { CurrentItemsObjects [i] = ScriptableObject.CreateInstance <ItemObject> (); } RenderCurrentItems(); }
public void ItemUse(int i) { // empty, just return if (CurrentItemsObjects [i].objectImage == null) { return; } // use effect ItemObjectLogic itemLogic = CurrentItemsObjects [i].itemLogic; itemLogic.UseItem(transform.Find("Misaki_SchoolUniform_summer"), CurrentItemsObjects [i]); // reduce from panel if (CurrentItemsObjects [i].quantity > 1) { CurrentItemsObjects [i].quantity -= 1; } else { CurrentItemsObjects [i] = ScriptableObject.CreateInstance <ItemObject> (); } RenderCurrentItems(); }