Advertisement
GoodNoodle

Menu Controller

Jan 19th, 2024 (edited)
945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1.  
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.EventSystems;
  6. using UnityEngine.UI;
  7.  
  8. public class MenuController : MonoBehaviour
  9. {
  10.     [SerializeField] Button[] menuButtons;
  11.    // [SerializeField] List<TextSlot> theButtons = new List<TextSlot>();
  12.  
  13.     [SerializeField] BattleSystem BS;
  14.  
  15.     [SerializeField] GameObject beastUI;
  16.     private void Start()
  17.     {
  18.       ButtonInit();
  19.  
  20.     }
  21.  
  22.     private void Update()
  23.     {
  24.        
  25.     }
  26.  
  27.     void ButtonInit()
  28.     {
  29.  
  30.         Enter();
  31.  
  32.         menuButtons[0].onClick.AddListener(() =>
  33.         {
  34.             Debug.Log("Party clicked");
  35.             StartCoroutine(BS.GoToPartyState());
  36.            
  37.         });
  38.  
  39.         menuButtons[1].onClick.AddListener(() => {
  40.             Debug.Log("item clicked");
  41.             StartCoroutine(BS.GoToInventoryState());
  42.         });
  43.  
  44.         menuButtons[3].onClick.AddListener(() => {
  45.    
  46.            
  47.         });
  48.  
  49.         menuButtons[4].onClick.AddListener(() => {
  50.  
  51.  
  52.         });
  53.  
  54.     }
  55.  
  56.     public void Enter(int currentButton = 0)
  57.     {
  58.        
  59.         EventSystem.current.SetSelectedGameObject(menuButtons[currentButton].gameObject);
  60.     }
  61.  
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement