Пример #1
0
    private void StopCurrentInput()
    {
        if (inputUpdateCoroutine != null)
        {
            StopCoroutine(inputUpdateCoroutine);
            inputUpdateCoroutine = null;
        }

        if (currentPlayerInputBase != null)
        {
            currentPlayerInputBase.TargetPositionUpdatedEvent -= OnTargetPositionUpdated;
            currentPlayerInputBase.Deactivate();
            currentPlayerInputBase = null;
        }
    }
Пример #2
0
    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();
    }