Files
Darklings-FightingGame/Assets/_Project/Scripts/UIScripts/MenuScripts/ControlsMenu.cs

32 lines
662 B
C#
Raw Normal View History

2022-07-15 00:01:28 +03:00
using Demonics.Sounds;
2022-03-12 19:55:32 +01:00
using Demonics.UI;
using UnityEngine;
public class ControlsMenu : BaseMenu
{
[SerializeField] private GameObject[] _controlSchemes = default;
2022-07-15 00:01:28 +03:00
private Audio _audio;
2022-03-12 19:55:32 +01:00
private int _currentControlSchemeIndex;
2022-07-15 00:01:28 +03:00
void Awake()
{
_audio = GetComponent<Audio>();
}
2022-03-12 19:55:32 +01:00
public void ToggleControlsScheme()
{
2022-07-15 00:01:28 +03:00
_audio.Sound("Select").Play();
2022-03-12 19:55:32 +01:00
_currentControlSchemeIndex++;
if (_currentControlSchemeIndex >= _controlSchemes.Length)
{
_currentControlSchemeIndex = 0;
}
for (int i = 0; i < _controlSchemes.Length; i++)
{
_controlSchemes[i].SetActive(false);
}
_controlSchemes[_currentControlSchemeIndex].SetActive(true);
}
}