//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Update Currently Active Buttons //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void UpdateCurrentlyActiveButtons() { foreach (ActiveInputButtons activeInput in m_lCurrentInput) { Button_Base[] activeButtons = activeInput.buttonObject.GetComponents <Button_Base>(); for (int i = 0; i < activeButtons.Length; ++i) { if (activeButtons[i].enabled) { ButtonState eButtonState = ButtonState.NO_CHANGE; if (activeInput.inputTriggered) { eButtonState = ButtonState.TRIGGERED; } else { ActiveInputButtons previousFrameInfo = m_lPreviousInput.GetExisting(activeInput.buttonObject); if (previousFrameInfo != null && previousFrameInfo.touchIDs.Count < activeInput.touchIDs.Count) { eButtonState = ButtonState.CLICKED; } } activeButtons[i].PushInputSystem(activeInput.touchIDs, eButtonState); } } } }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * Derived Method: Update //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Update() { m_lPreviousInput = m_lCurrentInput; m_lCurrentInput = new InputList(); LinkedList <FrameInputInfo> lInputInfo = GetUpdatedInputInfo(); foreach (FrameInputInfo input in lInputInfo) { if (input.hitObject != null) { ActiveInputButtons activeButton = m_lCurrentInput.GetOrNew(input.hitObject); activeButton.touchIDs.AddLast(input.inputID); if (input.triggered) { activeButton.inputTriggered = true; } } } UpdateReleasedButtons(); UpdateCurrentlyActiveButtons(); }