private static void ConnectToggleAction(IButton button, IStateMachine actuator, ButtonPressedDuration pressedDuration) { if (pressedDuration == ButtonPressedDuration.Short) { button.GetPressedShortlyTrigger().Attach(actuator.GetSetNextStateAction()); } else if (pressedDuration == ButtonPressedDuration.Long) { button.GetPressedLongTrigger().Attach(actuator.GetSetNextStateAction()); } else { throw new NotSupportedException(); } }