//Author: Ben Stern /// <summary> /// Attempt to empty the item in this container into something else /// </summary> /// <param name="itemToEmptyInto">an interactable Item containing</param> public void EmptyInto(InteractableBase itemToEmptyInto) { bool completed = false; for (int i = 0; i < itemsHolding.Count; i++) { itemToEmptyInto.Interact("Place Item", itemsHolding[i]); // Allows for the spatula to move onto the frying pan and plate itemToEmptyInto.Interact("Take Egg", interactableComponent); itemToEmptyInto.Interact("Place On Plate", itemsHolding[i]); //double check that the item is no longer in this container befor editing properties. if (itemsHolding[i].transform.parent != transform) { itemsHolding.RemoveAt(i); i--; completed = true; continue; } completed = false; } if (completed) { //remove the empty into interaction from the list interactableComponent.RemoveInteractionFromList("Empty into"); } if (HoldingWater) { if (itemToEmptyInto.gameObject.name == "Strainer") { itemToEmptyInto.Interact("Empty water", interactableComponent); } else { itemToEmptyInto.Interact("Fill water", interactableComponent); EmptyWater(); } } }
//Author: John Vance, Ben Stern /// <summary> /// Attempt to empty the item in this container into something else /// </summary> /// <param name="itemToEmptyInto">an interactable Item containing</param> public void EmptyInto(InteractableBase itemToEmptyInto) { // Allows for the spatula to move onto the frying pan and plate itemToEmptyInto.Interact("Take Egg", interactableComponent); //double check that the item is no longer in this container befor editing properties. if (currentContainer.transform.parent != transform) { currentContainer = null; //remove the empty into interaction from the list interactableComponent.RemoveInteractionFromList("Empty into"); } }