Esempio n. 1
0
        /// <summary>
        /// (Cross-Game compatible) Gets all objects of type T. Does this by returning all objects created by the Factory of type T
        /// </summary>
        /// <typeparam name="T">The type of items you want</typeparam>
        public static List <T> GetAllObjectsOfType <T>(this InGame inGame) where T : RootObject, new()
        {
            var factory = inGame.GetMainFactory()?.GetFactory <T>();

#if BloonsTD6
            return(factory?.all?.ToList());
#elif BloonsAT
            return(factory?.active?.ToList());
#endif
        }
Esempio n. 2
0
 /// <summary>
 /// (Cross-Game compatible) Get the Factory for a specific Type. Ex: Getting the Factory that makes Towers
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="inGame"></param>
 /// <returns></returns>
 public static Factory <T> GetFactory <T>(this InGame inGame) where T : RootObject, new()
 {
     return(inGame.GetMainFactory()?.GetFactory <T>());
 }