예제 #1
0
    private void Restart(InputType inputType)
    {
        _menuIsActive = false;
        menu.SetActive(_menuIsActive);
        Time.timeScale = 1;

        _myScore    = 0;
        _rivalScore = 0;

        myScoreText.text    = string.Format(bestScoreFormat, _myScore.ToString(), _myBestScore.ToString());
        rivalScoreText.text = string.Format(bestScoreFormat, _rivalScore.ToString(), _rivalBestScore.ToString());

        rivalRacket.SetInput(_inputs[inputType]);

        ball.transform.localPosition = new Vector2(10000, 10000);
        ball.SetSize(Random.Range(0.1f, 1f));
        ball.SetColor(Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f));

        if (_launchCoroutine != null)
        {
            StopCoroutine(_launchCoroutine);
        }
        _launchCoroutine = StartCoroutine(LaunchBall());
    }