예제 #1
0
        /// <summary>
        /// Creates the list of theme instances based on all the theme settings
        /// Themes will be created for the current dimension index
        /// </summary>
        protected virtual void SetupThemes()
        {
            activeThemes.Clear();

            // Profiles are one per GameObject/ThemeContainer
            // ThemeContainers are one per dimension
            // ThemeDefinitions are one per desired effect (i.e theme)
            foreach (var profile in Profiles)
            {
                if (profile.Target != null && profile.Themes != null)
                {
                    if (dimensionIndex >= 0 && dimensionIndex < profile.Themes.Count)
                    {
                        var themeContainer = profile.Themes[dimensionIndex];
                        if (themeContainer.States.Equals(States))
                        {
                            foreach (var themeDefinition in themeContainer.Definitions)
                            {
                                activeThemes.Add(InteractableThemeBase.CreateAndInitTheme(themeDefinition, profile.Target));
                            }
                        }
                        else
                        {
                            Debug.LogWarning($"Could not use {themeContainer.name} in Interactable on {gameObject.name} because Theme's States does not match {States.name}");
                        }
                    }
                }
            }
        }
        /// <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)
        {
            Type themeType = Type.GetType(settings.AssemblyQualifiedName);
            InteractableThemeBase theme = (InteractableThemeBase)Activator.CreateInstance(themeType);

            theme.Init(host, settings);
            return(theme);
        }
예제 #3
0
        /// <summary>
        /// Utility function to generate the default ThemeDefinition configuration for the provided type of Theme engine
        /// </summary>
        /// <param name="themeType">type of Theme Engine to build default configuration for</param>
        /// <returns>Default ThemeDefinition configuration for the provided them type</returns>
        public static ThemeDefinition?GetDefaultThemeDefinition(Type themeType)
        {
            var theme = InteractableThemeBase.CreateTheme(themeType);

            if (theme != null)
            {
                return(theme.GetDefaultThemeDefinition());
            }

            return(null);
        }
예제 #4
0
        /// <summary>
        /// Create and initialize Theme Engines with the associated Target and Theme property
        /// </summary>
        /// <returns>List of Theme Engine instances</returns>
        public List <InteractableThemeBase> CreateThemeEngines()
        {
            List <InteractableThemeBase> results = new List <InteractableThemeBase>();

            if (Theme != null)
            {
                foreach (var definition in Theme.Definitions)
                {
                    results.Add(InteractableThemeBase.CreateAndInitTheme(definition, Target));
                }
            }

            return(results);
        }
예제 #5
0
        public List <InteractableThemeBase> CreateThemeEngines()
        {
            List <InteractableThemeBase> results = new List <InteractableThemeBase>();

            if (Theme != null)
            {
                foreach (var setting in Theme.Settings)
                {
                    Type themeType = Type.GetType(setting.AssemblyQualifiedName);
                    InteractableThemeBase theme = (InteractableThemeBase)Activator.CreateInstance(themeType);
                    theme.Init(Target, setting);

                    results.Add(theme);
                }
            }

            return(results);
        }