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(); } }
private void OnInteractionCompleted() { InteractionCompleted?.Invoke(this, EventArgs.Empty); }
public void StopInteract() { InteractionCompleted?.Invoke(); }