public LabelledComponentKeeper() { foreach (TagPair pair in tagPairs) { // Use utility to get all labelled components T[] array = LabelledComponentUtility.FindComponentsWithLabel <T>(pair.gameObjectTag, pair.labelledComponentTag); // Add all found components to the list foreach (T component in array) { components.Add(component); } } }
// Try to find a stockpile on each of the game objects given public static Stockpile[] FindStockpilesWithLabel(GameObject[] gObjects, string stockpileLabel) { return(LabelledComponentUtility.FindComponentsWithLabel <Stockpile>(gObjects, stockpileLabel)); }
// Find all game objects with the given tag, then try to find a single stockpile on each game object with the tag given public static State[] FindStatesWithLabel(string gObjectTag, string stockpileLabel) { return(LabelledComponentUtility.FindComponentsWithLabel <State>(gObjectTag, stockpileLabel)); }