internal void AddCopyOfState(InputStateBase inputState, ViewInformation?viewInfo) { // Get the state object to where to copy the given InputState InputStateBase?targetState = null; for (var loop = 0; loop < _recoveredStates.Count; loop++) { if (_recoveredStates[loop].CurrentType == inputState.CurrentType) { targetState = _recoveredStates[loop]; _recoveredStates.RemoveAt(loop); break; } } if (targetState == null) { targetState = (InputStateBase)Activator.CreateInstance(inputState.CurrentType) !; } // Copy all state data inputState.CopyAndResetForUpdatePass(targetState); targetState.RelatedView = viewInfo; this.AddState(targetState); }