evershade/Assets/SideBarUIController.cs

74 lines
1.8 KiB
C#

using Managers;
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 UIManager uiManager;
public int TotalPanels = 5;
public Vector3 initialIndicatorPosition;
// Start is called before the first frame update
private void Start()
{
initialIndicatorPosition = ActivePanelIndicatorImage.transform.localPosition;
// uiManager = GetCompo
}
// Update is called once per frame
private void Update()
{
}
public void OnClick_EnableInventory()
{
uiManager.ClosePanels();
uiManager.EnableInventory();
MoveIndicatorToActivePanel(3);
}
public void MoveIndicatorToActivePanel(int panelIndex)
{
ActivePanelIndicatorImage.transform.localPosition =
new Vector3(ActivePanelIndicatorImage.transform.localPosition.x,
initialIndicatorPosition.y - panelIndex * 26);
}
public void OnClick_Settings()
{
uiManager.ClosePanels();
uiManager.EnableSettings();
MoveIndicatorToActivePanel(4);
}
public void OnClick_Character()
{
uiManager.ClosePanels();
uiManager.EnableCharacter();
MoveIndicatorToActivePanel(0);
}
public void OnClick_Relationships()
{
uiManager.ClosePanels();
uiManager.EnableRelationships();
MoveIndicatorToActivePanel(2);
}
public void OnClick_Knowledge()
{
uiManager.ClosePanels();
uiManager.EnableKnowledge();
MoveIndicatorToActivePanel(1);
}
}