Exemplo n.º 1
0
    // All these key methods could be grouped up a lot nicer later using delegates and refs
    private bool KeysPressed(Event currentEvent, KeyCode key, MAST_Hotkey_ScriptableObject.Modifier mod)
    {
        // If correct key was pressed for the first time
        if (currentEvent.keyCode == key)
        {
            // If the correct modifier was held down
            if (IsModifierPressed(currentEvent, mod))
            {
                return(true);
            }
        }

        return(false);
    }
Exemplo n.º 2
0
    // Return true if the correct modifier key is held down
    private bool IsModifierPressed(Event currentEvent, MAST_Hotkey_ScriptableObject.Modifier modifier)
    {
        // If SHIFT is needed and is held down, return true
        if (modifier == MAST_Hotkey_ScriptableObject.Modifier.SHIFT && currentEvent.shift)
        {
            return(true);
        }

        // If SHIFT is not needed and SHIFT is not held down, return true
        else if (modifier == MAST_Hotkey_ScriptableObject.Modifier.NONE && !currentEvent.shift)
        {
            return(true);
        }

        return(false);
    }