private void Update()
    {
        if (!_interactionStarted)
        {
            return;
        }

        transform.LookAt(transform.position + cam.transform.rotation * Vector3.forward, cam.transform.rotation * Vector3.up);

        _currentTimeForComplete += Time.deltaTime;
        _progressBar.value       = _currentTimeForComplete / _timeToCompleteInteraction;

        if (_currentTimeForComplete >= _timeToCompleteInteraction)
        {
            _progressBar.value      = 0;
            _canvas.enabled         = false;
            _currentTimeForComplete = 0f;
            _interactionStarted     = false;
            InteractionCompleted?.Invoke();
        }
    }
Exemple #2
0
 private void OnInteractionCompleted()
 {
     InteractionCompleted?.Invoke(this, EventArgs.Empty);
 }
Exemple #3
0
 public void StopInteract()
 {
     InteractionCompleted?.Invoke();
 }