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); }
public void ResetGame() { playerScore = 0; computerScore = 0; Computer.transform.position = ComputerSpawn.position; pc.Reset(); }
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); }