You've already forked Darklings-FightingGame
mirror of
https://github.com/izzy2lost/Darklings-FightingGame.git
synced 2026-03-10 11:35:19 -07:00
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class ControlsMenu : BaseMenu
|
|
{
|
|
[SerializeField] private InputManager _inputManager = default;
|
|
[SerializeField] private GameObject[] _controlSchemes = default;
|
|
[SerializeField] private Selectable _firstSelectable = default;
|
|
private Audio _audio;
|
|
private int _currentControlSchemeIndex;
|
|
|
|
|
|
void Awake()
|
|
{
|
|
_audio = GetComponent<Audio>();
|
|
}
|
|
|
|
public void ToggleControlsScheme()
|
|
{
|
|
_audio.Sound("Select").Play();
|
|
_currentControlSchemeIndex++;
|
|
if (_currentControlSchemeIndex >= _controlSchemes.Length)
|
|
{
|
|
_currentControlSchemeIndex = 0;
|
|
}
|
|
for (int i = 0; i < _controlSchemes.Length; i++)
|
|
{
|
|
_controlSchemes[i].SetActive(false);
|
|
}
|
|
_controlSchemes[_currentControlSchemeIndex].SetActive(true);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
PreviousSelectable.Select();
|
|
_inputManager.SetPrompts(_inputManager.PreviousPrompts);
|
|
if (HotBarToggle.PreviousSelected != null)
|
|
EventSystem.current.SetSelectedGameObject(HotBarToggle.PreviousSelected.gameObject);
|
|
}
|
|
}
|