// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Input; using System.Collections.Generic; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.UI { /// /// Adds or removes materials to target renderer for highlighting Focused GameObjects. /// /// Useful with focusable GameObjects [AddComponentMenu("Scripts/MRTK/SDK/InteractableOnFocus")] public class InteractableOnFocus : BaseFocusHandler { /// /// List of profiles can match themes with gameObjects /// [SerializeField] [HideInInspector] protected List Profiles = new List(); protected InteractableStates.InteractableStateEnum State { get { return HasFocus ? InteractableStates.InteractableStateEnum.Focus : InteractableStates.InteractableStateEnum.Default; } } private List themes = new List(); public void Awake() { foreach (var profile in Profiles) { var themeEngines = profile.CreateThemeEngines(); themes.AddRange(themeEngines); } } public void Update() { foreach (var theme in themes) { theme.OnUpdate((int)State, false); } } } }