/// <summary> /// </summary> /// <param name="player"> /// </param> /// <param name="timeLineItem"> /// </param> private void SendPlayerInput(int player, TimeLineItemViewModel timeLineItem) { InputCommandModel icm = timeLineItem.InputItemViewModel.InputItem.InputCommandState; foreach (Input input in icm.ToInputsReleasedArray()) { InputSimulator.SimulateKeyUp(_inputResolver.Get(input, player)); } foreach (Input input in icm.ToInputsPressedArray()) { InputSimulator.SimulateKeyDown(_inputResolver.Get(input, player)); } }
/// <summary> /// Performs all presses and releases for a time line item. /// </summary> /// <param name="timeLineItem"> /// </param> /// <param name="sendInputs"> /// </param> /// <param name="player"> /// </param> private void Action(TimeLineItemViewModel timeLineItem, bool sendInputs, int player = 1) { if (sendInputs) { InputCommandModel icm = timeLineItem.InputItemViewModel.InputItem.InputCommandState; foreach (Input input in icm.ToInputsReleasedArray()) { InputSimulator.SimulateKeyUp(_inputResolver.Get(input, player)); } foreach (Input input in icm.ToInputsPressedArray()) { InputSimulator.SimulateKeyDown(_inputResolver.Get(input, player)); } WaitForFrames(1); } else { // press event waits 1 frame, if send inputs is disabled wait frame is maintained WaitForFrames(1); } if (timeLineItem.InputItemViewModel.PlaySound) { Input[] inputs = timeLineItem.InputItemViewModel.InputItem.Inputs; if (inputs.Intersect(Directions).Count() == 0 && inputs.Intersect(Buttons).Count() == 0) { Roadie.Instance.PlaySound(Roadie.WAIT_SOUND); } else { if (inputs.Intersect(Buttons).Count() > 0) { Roadie.Instance.PlaySound(Roadie.PRESS_BUTTON_SOUND); } if (inputs.Intersect(Directions).Count() > 0) { Roadie.Instance.PlaySound(Roadie.PRESS_DIRECTION_SOUND); } } } // After sound has played we wait the remainder of the frame duration if (timeLineItem.WaitFrames > 1) { WaitForFrames(timeLineItem.WaitFrames - 1); } }