示例#1
0
            // return true if  frame skipped
            public override bool Update()
            {
                if (m_state.Update())
                {
                    return(true);
                }

                var timeNow = Time.unscaledTime;

                for (ControllerButton button = 0; button < (ControllerButton)CONTROLLER_BUTTON_COUNT; ++button)
                {
                    if (GetPress(button))
                    {
                        if (GetPressDown(button))
                        {
                            // PressDown event
                            TryInvokeListener(button, ButtonEventType.Down);
                        }

                        // Press event
                        TryInvokeListener(button, ButtonEventType.Press);
                    }
                    else if (GetPressUp(button))
                    {
                        // PressUp event
                        TryInvokeListener(button, ButtonEventType.Up);

                        if (timeNow - m_state.LastPressDownTime(button) < clickInterval)
                        {
                            // Click event
                            TryInvokeListener(button, ButtonEventType.Click);
                        }
                    }
                }

                return(false);
            }
 public override float LastPressDownTime(ControllerButton button)
 {
     return(m_state.LastPressDownTime(button));
 }