void PerformActionOnActionable(Actionable actionable) { playClip(); // If we don't have anything, then we can't perform an action if (heldItems.Count == 0) { return; } // Pass the most appropriate thing that we have in else { Actionable matchedItem = null; HashSet <string> matchingAttribs = null; foreach (Actionable item in heldItems) { //Debug.Log("Trying " + item.name + " with " + actionable.name + "..."); matchingAttribs = item.GetAttributes(); matchingAttribs.IntersectWith(actionable.GetAttributes()); if (matchingAttribs.Count > 0) { matchedItem = item; break; } } if (matchedItem) { actionable.PerformAction(matchingAttribs, matchedItem, this); } } }