/// <summary> /// Test to see if the Digital Painting is setup correctly in the current scene. /// </summary> //were found.</returns> public virtual void Validate() { timeToNextValidation -= Time.deltaTime; if (timeToNextValidation <= 0) { Validations = new ValidationResultCollection(); AbstractPluginManager[] pluginManagers = GameObject.FindObjectsOfType <AbstractPluginManager>(); for (int i = 0; i < pluginManagers.Length; i++) { Type genericType = typeof(ValidationTest <>).MakeGenericType(new Type[] { pluginManagers[i].GetType() }); IEnumerable <Type> validationTypes = Assembly.GetAssembly(genericType).GetTypes() .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(genericType)); foreach (Type type in validationTypes) { var test = Activator.CreateInstance(type); MethodInfo method = type.GetMethod("Validate"); ValidationResultCollection results = (ValidationResultCollection)method.Invoke(test, new object[] { type, pluginManagers[i] }); Validations.AddOrUpdateAll(results); } } timeToNextValidation = frequencyOfValidation; } }