Example #1
0
        void RegisterKey(KeyAction keyAction)
        {
            var match = registeredKeys.Find(ka => ka.type == keyAction.type);

            if (match != null)
            {
                registeredKeys.Remove(match);
            }

            registeredKeys.Add(keyAction);
        }
Example #2
0
        /// <summary> You can get any action to setup it's Press event. </summary>
        public KeyAction GetAction(KeyActionType type)
        {
            for (int i = 0; i < registeredKeys.Count; i++)
            {
                if (registeredKeys[i].type == type)
                {
                    return(registeredKeys[i]);
                }
            }

            var action = new KeyAction(type, KeyCode.K);

            RegisterKey(action);

            return(action);
        }