Example #1
0
    public static void RevertToDefaultBindings()
    {
        CurrentKeybindings.Clear();
        UnsavedKeybindings.Clear();

        CurrentKeybindings.Add("Up", new Keybinds(KeyCode.W, KeyCode.Break, false));
        CurrentKeybindings.Add("Down", new Keybinds(KeyCode.S, KeyCode.Break, false));
        CurrentKeybindings.Add("Left", new Keybinds(KeyCode.A, KeyCode.Break, false));
        CurrentKeybindings.Add("Right", new Keybinds(KeyCode.D, KeyCode.Break, false));
        CurrentKeybindings.Add("Jump", new Keybinds(KeyCode.Space, KeyCode.JoystickButton0, false));                            // A
        CurrentKeybindings.Add("Fire", new Keybinds(KeyCode.Return, KeyCode.JoystickButton3, false));                           // Y
        CurrentKeybindings.Add("Dash", new Keybinds(KeyCode.E, KeyCode.JoystickButton2, false));                                // X

        CurrentKeybindings.Add("ResetScene", new Keybinds(KeyCode.P, KeyCode.Break, true));
        CurrentKeybindings.Add("UIBack", new Keybinds(KeyCode.Escape, KeyCode.JoystickButton1, true));
        CurrentKeybindings.Add("Pause", new Keybinds(KeyCode.Escape, KeyCode.JoystickButton7, true));

        UnsavedKeybindings.Add("Up", new Keybinds(KeyCode.W, KeyCode.Break, false));
        UnsavedKeybindings.Add("Down", new Keybinds(KeyCode.S, KeyCode.Break, false));
        UnsavedKeybindings.Add("Left", new Keybinds(KeyCode.A, KeyCode.Break, false));
        UnsavedKeybindings.Add("Right", new Keybinds(KeyCode.D, KeyCode.Break, false));
        UnsavedKeybindings.Add("Jump", new Keybinds(KeyCode.Space, KeyCode.JoystickButton0, false));                            // A
        UnsavedKeybindings.Add("Fire", new Keybinds(KeyCode.Return, KeyCode.JoystickButton3, false));                           // Y
        UnsavedKeybindings.Add("Dash", new Keybinds(KeyCode.E, KeyCode.JoystickButton2, false));                                // X

        UnsavedKeybindings.Add("ResetScene", new Keybinds(KeyCode.P, KeyCode.Break, true));
        UnsavedKeybindings.Add("UIBack", new Keybinds(KeyCode.Escape, KeyCode.JoystickButton1, true));
        UnsavedKeybindings.Add("Pause", new Keybinds(KeyCode.Escape, KeyCode.JoystickButton7, true));

        RevertChangesToCurrent();
    }
Example #2
0
    public static bool GetButtonUp(string buttonName)
    {
        if (!CurrentKeybindings.ContainsKey(buttonName))
        {
            return(false);
        }

        return(IsUsingController ? Input.GetKeyUp(CurrentKeybindings[buttonName].ControllerBinds) : Input.GetKeyUp(CurrentKeybindings[buttonName].KeyboardBinds));
    }
Example #3
0
    public static string[] GetNamesForButton(string buttonName)
    {
        if (CurrentKeybindings.ContainsKey(buttonName) == false)
        {
            Debug.LogError("InputManager::GetKeyNameForButton -- No button named: " + buttonName);
            return(null);
        }

        return(new string[] { CurrentKeybindings[buttonName].KeyboardBinds.ToString(), CurrentKeybindings[buttonName].ControllerBinds.ToString() });
    }