Ejemplo n.º 1
0
 /// <summary>
 /// Resets (pauses) the <see cref="ManualResetEvent" /> with a specified client count.
 /// </summary>
 /// <remarks>
 /// The count determines how many clients must pause before an event is sent
 /// </remarks>
 /// <param name="count">The count.</param>
 public void Pause(int count)
 {
     lock (_lock)
     {
         _clientsToPause = count;
         _pauseEvent.Reset();
         OnPauseRequested?.Invoke(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 2
0
        private void Awake()
        {
            OnPauseRequested      += HandlePause;
            OnGameResumeRequested += HandleResumeGame;
            m_BackButton.onClick.AddListener(() => {
                OnBackToMenuRequested?.Invoke();
            });

            m_PauseButton.onClick.AddListener(() => {
                OnPauseRequested?.Invoke();
            });
            m_ResumeButton.onClick.AddListener(() => {
                OnGameResumeRequested?.Invoke();
            });
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            canBeTouched = true;
            var pauseKey = Observable.EveryUpdate()
                           .Where(_ => Input.GetKeyDown(KeyCode.Escape))
                           .Subscribe(_ => OnPauseRequested?.Invoke());
            var click = Observable.EveryUpdate()
                        .Where(_ => Input.GetButtonDown("Fire1"))
                        .Subscribe(_ =>
            {
                if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hit))
                {
                    OnTouch?.Invoke(hit.point.ToVector());
                }
            });

            disposables = new IDisposable[] { pauseKey, click };
        }