using UnityEngine; public class SideBarUIController : MonoBehaviour { public GameObject InventoryPanel; public GameObject SettingsPanel; public GameObject CharacterPanel; public GameObject RelationshipsPanel; public GameObject KnowledgePanel; public GameObject ActivePanelIndicatorImage; public int TotalPanels = 5; public Vector3 initialIndicatorPosition; // Start is called before the first frame update private void Start() { initialIndicatorPosition = ActivePanelIndicatorImage.transform.localPosition; } // Update is called once per frame private void Update() { } private void ClosePanels() { InventoryPanel.SetActive(false); SettingsPanel.SetActive(false); CharacterPanel.SetActive(false); RelationshipsPanel.SetActive(false); } public void OnClick_Inventory() { ClosePanels(); InventoryPanel.SetActive(true); MoveIndicatorToActivePanel(3); } public void MoveIndicatorToActivePanel(int panelIndex) { ActivePanelIndicatorImage.transform.localPosition = new Vector3(ActivePanelIndicatorImage.transform.localPosition.x, initialIndicatorPosition.y - panelIndex * 26); } public void OnClick_Settings() { ClosePanels(); SettingsPanel.SetActive(true); MoveIndicatorToActivePanel(4); } public void OnClick_Character() { ClosePanels(); CharacterPanel.SetActive(true); MoveIndicatorToActivePanel(0); } public void OnClick_Relationships() { ClosePanels(); RelationshipsPanel.SetActive(true); MoveIndicatorToActivePanel(2); } public void OnClick_Knowledge() { ClosePanels(); KnowledgePanel.SetActive(true); MoveIndicatorToActivePanel(1); } }