/// <summary> /// Get a new theme instance and load it with settings /// </summary> /// <param name="settings"></param> /// <param name="host"></param> /// <param name="lists"></param> /// <returns></returns> public static InteractableThemeBase GetTheme(InteractableThemePropertySettings settings, GameObject host, ThemeLists lists) { int index = InspectorField.ReverseLookup(settings.Name, lists.Names.ToArray()); Type themeType = lists.Types[index]; InteractableThemeBase theme = (InteractableThemeBase)Activator.CreateInstance(themeType, host); theme.Init(host, settings); return(theme); }
private IEnumerator TestTheme <C>( GameObject host, ThemeDefinition themeDefinition, params Action <InteractableThemeBase>[] stateTests) where C : UnityEngine.Component { host.AddComponent <C>(); var theme = InteractableThemeBase.CreateAndInitTheme(themeDefinition, host); for (int i = 0; i < stateTests.Length; i++) { theme.OnUpdate(i); yield return(null); stateTests[i](theme); } GameObjectExtensions.DestroyGameObject(host); }