/// --------------------------------------------- /// Ultimate Character Controller /// Copyright (c) Opsive. All Rights Reserved. /// https://www.opsive.com /// --------------------------------------------- namespace Opsive.UltimateCharacterController.Demo.UI { using Opsive.Shared.Events; using Opsive.UltimateCharacterController.Character; using Opsive.UltimateCharacterController.Game; using Opsive.UltimateCharacterController.Utility; using UnityEngine; using UnityEngine.UI; /// /// Abstract class which manages the UI for the demo zones. /// public abstract class UIZone : MonoBehaviour { [Tooltip("A reference to the UI parent GameObject.")] [SerializeField] protected GameObject m_UIParent; [Tooltip("A reference to the buttons that correspond to the InputTypes. These buttons must be in the same order as the enum.")] [SerializeField] protected Image[] m_ButtonImages; protected Color m_NormalColor; protected Color m_PressedColor; protected Button[] m_Buttons; protected GameObject m_ActiveCharacter; /// /// Initialize the default values. /// protected virtual void Awake() { m_Buttons = new Button[m_ButtonImages.Length]; var firstIndex = -1; for (int i = 0; i < m_Buttons.Length; ++i) { if (m_ButtonImages[i] == null) { continue; } if (firstIndex == -1) { firstIndex = i; } m_Buttons[i] = m_ButtonImages[i].GetComponent