public void DoInteract(Interactor interactor)
        {
            CanInteract = false;

            _currentPlayerInput = interactor.GetComponent <PlayerInput>();

            if (!_currentPlayerInput)
            {
                CanInteract = true;
                Debug.LogError($"Interactor object {interactor.gameObject} does not have PlayerInput component!");
                return;
            }

            _previousPlayerMap = _currentPlayerInput.currentActionMap.name;
            StartCoroutine(SwitchControls(_currentPlayerInput, actionMap));

            _curretnCloseUpController = interactor.GetComponent <CloseUpController>();

            if (_curretnCloseUpController)
            {
                _curretnCloseUpController.PerformCloseUp(transform, () =>
                {
                    russianEggsMain.StartGame();
                    BindPlayerInput(_currentPlayerInput);
                });
            }
            else
            {
                russianEggsMain.StartGame();
                BindPlayerInput(_currentPlayerInput);
            }
        }
        public void OnExitGame(InputAction.CallbackContext context)
        {
            russianEggsMain.ExitGame();
            UnbindPlayerInput(_currentPlayerInput);

            StartCoroutine(SwitchControls(_currentPlayerInput, _previousPlayerMap));
            _currentPlayerInput = null;

            _curretnCloseUpController?.PerformReturnObject(() => CanInteract = true);
            _curretnCloseUpController = null;
        }
예제 #3
0
 void Awake()
 {
     _playerInput       = player.GetComponent <PlayerInput>();
     _interactor        = player.GetComponent <Interactor>();
     _closeUpController = player.GetComponent <CloseUpController>();
 }