Example #1
0
    public void PlayerScored(PlayerType playerType)
    {
        switch (playerType)
        {
        case PlayerType.player1:
            player1Score++;
            break;

        case PlayerType.player2:
            player2Score++;
            break;

        default:
            throw new System.Exception("Invalid PlayerType passed to Score");
        }

        if (playerScored_sound != null)
        {
            playerScored_sound.Play();
        }

        UpdateScoreText();

        ball.Reset();
        player1.Reset();
        player2.Reset();

        Invoke(nameof(StartMovingBall), 2f);
    }
Example #2
0
 public void ResetGame()
 {
     playerScore   = 0;
     computerScore = 0;
     Computer.transform.position = ComputerSpawn.position;
     pc.Reset();
 }
Example #3
0
    void StartRound(int time)
    {
        m_ball.ChangeColor(Color.white);
        Vector3 position = GenerateStartingPosition(m_side);

        //Debug.Log(position.ToString());
        m_ball.transform.position = new Vector2(position.x, position.y);
        m_ball.ChangeAngle(position.z);

        m_paddles.Reset();
        m_paddles.SetControl(true);

        m_countdown.Start_Countdown(time, Begin);
    }