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 a stockpile on the given game object with the given tag public static Stockpile FindStockpileWithLabel(GameObject gObject, string stockpileLabel) { return(LabelledComponentUtility.FindComponentWithLabel <Stockpile>(gObject, stockpileLabel)); }
// Find a game object with the given tag, then find a stockpile on that game object with the given tag public static State FindStateWithLabel(string gObjectTag, string stockpileLabel) { return(LabelledComponentUtility.FindComponentWithLabel <State>(gObjectTag, stockpileLabel)); }