/// <summary> /// Sets control scheme when user interacts with a toggle /// </summary> /// <param name="newScheme">bounded index of selected control scheme /// within ControlSchemes enum</param> public void SelectControlScheme(int newScheme) { // update control scheme and diagram ControlSchemeManager.SetControlScheme((ControlSchemes)Mathf.Max(0, Mathf.Min(System.Enum.GetNames(typeof(ControlSchemes)).Length, newScheme))); AudioManager.Play(AudioClipNames.UI_buttonPress, true); UpdateDiagram(); }
private void OnEnable() { spriteRenderer = GetComponent <SpriteRenderer>(); GameObject player = GameObject.FindWithTag("Player"); playerInput = player.GetComponent <PlayerInput>(); if (playerInput != null) { ControlSchemeManager.Instance.ControlSchemeChanged += OnControlSchemeChanged; ControlSchemeManager.SetControlScheme(playerInput, ControlSchemeManager.Instance.LastUsedControlScheme); OnControlSchemeChanged(playerInput.currentControlScheme); } }