Exemple #1
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();
            }
        }
    }
Exemple #2
0
 private void OnRestartPressedAction()
 {
     OnRestartPressed?.Invoke();
 }
Exemple #3
0
 internal void OnRestartGame()
 {
     OnRestartPressed?.Invoke();
 }