// return true if frame skipped public override bool Update() { if (m_state.Update()) { return(true); } //Debug.Log("RGCtrolState<" + typeof(TRole).Name + "> Update"); for (int i = 0; i < CONTROLLER_BUTTON_COUNT; ++i) { InvokeEvent((ControllerButton)i); } return(false); }
// 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); }