Beispiel #1
0
        /// <summary>
        /// This methode can be used in a update function to detect if a certain key is pressed down. For example:
        /// If(Input.onKeyDown(KeyCode.Space)){
        ///     // this is called when the space bar is pressed down
        /// }
        /// </summary>
        /// <param name="code"></param>
        /// <returns>Returns true or false</returns>
        public static bool onKeyDown(KeyCode code)
        {
            keyObj key = keycodes.keys[code];

            if (key != null)
            {
                bool b = key.isDown();
                if (b)
                {
                    key.waitForChange = true;
                }

                return(b);
            }
            else
            {
                return(false);
            }
        }