private void StopCurrentInput() { if (inputUpdateCoroutine != null) { StopCoroutine(inputUpdateCoroutine); inputUpdateCoroutine = null; } if (currentPlayerInputBase != null) { currentPlayerInputBase.TargetPositionUpdatedEvent -= OnTargetPositionUpdated; currentPlayerInputBase.Deactivate(); currentPlayerInputBase = null; } }
private void StartInput(PlayerInputType _playerInputType) { PlayerBaseInput _playerInputBase = playerInputs.Find(x => x.PlayerInputType == _playerInputType); if (_playerInputBase == null) { Debug.LogError("No PlayerInput of type " + _playerInputType, gameObject); return; } StopCurrentInput(); currentPlayerInputBase = _playerInputBase; currentPlayerInputBase.TargetPositionUpdatedEvent += OnTargetPositionUpdated; currentPlayerInputBase.Activate(); }