/// <summary>
        /// Returns if the button is true with the specified ButtonAction.
        /// </summary>
        /// <param name="name">The name of the button.</param>
        /// <param name="action">The type of action to check.</param>
        /// <returns>The status of the action.</returns>
        public bool GetButton(string name, InputBase.ButtonAction action)
        {
            VirtualControl virtualControl;

            if (!m_NameVirtualControlsMap.TryGetValue(name, out virtualControl))
            {
                //Debug.LogError("Error: No virtual input object exists with the name " + name);
                return(false);
            }

            return(virtualControl.GetButton(action));
        }
        /// <summary>
        /// Returns if the button is true with the specified ButtonAction.
        /// </summary>
        /// <param name="action">The type of action to check.</param>
        /// <returns>The status of the action.</returns>
        public override bool GetButton(InputBase.ButtonAction action)
        {
            if (action == InputBase.ButtonAction.GetButton)
            {
                return(m_Pressed);
            }

            // GetButtonDown and GetButtonUp requires the button to be pressed or released within the same frame.
            if (Time.frameCount - m_Frame > 0)
            {
                return(false);
            }

            return(action == InputBase.ButtonAction.GetButtonDown ? m_Pressed : !m_Pressed);
        }
예제 #3
0
 /// <summary>
 /// Returns if the button is true with the specified ButtonAction.
 /// </summary>
 /// <param name="action">The type of action to check.</param>
 /// <returns>The status of the action.</returns>
 public virtual bool GetButton(InputBase.ButtonAction action)
 {
     return(false);
 }