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 OnRestartPressedAction() { OnRestartPressed?.Invoke(); }
internal void OnRestartGame() { OnRestartPressed?.Invoke(); }