private void StopCountHold() { _holdTouchesCount--; if (_holdTouchesCount == 0) { OnLaunchReleased?.Invoke(Time.time - _pressedTime); _pressedTime = 0; } }
private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { _holdStartTime = Time.time; } if (Input.GetKeyUp(KeyCode.Space) && _holdStartTime > 0) { OnLaunchReleased?.Invoke(Time.time - _holdStartTime); _holdStartTime = 0; } if (_holdStartTime == 0) { if (Input.GetKeyDown(KeyCode.A)) { InvokeFlipperAction(Side.Left, FlipperDirection.Up); } else if (Input.GetKeyUp(KeyCode.A)) { InvokeFlipperAction(Side.Left, FlipperDirection.Down); } if (Input.GetKeyDown(KeyCode.D)) { InvokeFlipperAction(Side.Right, FlipperDirection.Up); } else if (Input.GetKeyUp(KeyCode.D)) { InvokeFlipperAction(Side.Right, FlipperDirection.Down); } else if (Input.GetKeyUp(KeyCode.T)) { OnStartPressed?.Invoke(); } else if (Input.GetKeyUp(KeyCode.R)) { OnRestartPressed?.Invoke(); } } }
private void OnLaunchReleasedAction(float obj) { OnLaunchReleased?.Invoke(obj); }
private IEnumerator StartGame() { yield return(_startWaiter); OnLaunchReleased?.Invoke(Random.Range(0.8f, 1.5f)); }