示例#1
0
    // Update is called once per frame
    public override void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            BallStart();
        }

        if (transform.position.x > 8)
        {
            PlayerPoints++;
            PlayerSide.text = "Player  " + PlayerPoints.ToString();
            BallFinish();
        }
        else if (transform.position.x < -8)
        {
            EnemyPoints++;
            EnemySide.text = EnemyPoints.ToString() + "  Computer";
            BallFinish();
        }

        if (PlayerPoints == 3)
        {
            SceneManager.LoadScene("Winner");
        }
        else if (EnemyPoints == 3)
        {
            SceneManager.LoadScene("Looser");
        }
    }