private void RemoveReceiverFrom <T>(IInputBound inputReceiver) where T : MoveInputControllerBase { MoveInputControllerBase targetController = null; foreach (MoveInputControllerBase value in _inputReceiverCollection.Keys) { if (value is T) { targetController = value; break; } } if (targetController != null) { _inputReceiverCollection[targetController].Remove(inputReceiver); } }
private void AddReceiverTo <T>(IInputBound inputReceiver) where T : MoveInputControllerBase { if (!_isInited) { Init(); } MoveInputControllerBase targetController = null; foreach (MoveInputControllerBase value in _inputReceiverCollection.Keys) { if (value is T) { targetController = value; break; } } if (targetController != null) { _inputReceiverCollection[targetController].Add(inputReceiver); } }
private void OnInputCancelled(Vector2 input, MoveInputControllerBase controller) { _inputReceiverCollection[controller].ForEach(val => val.OnInputCancelled(input)); }