void Start () { speed = StartSpeed; particles = transform.Find("BallParticle").GetComponent<ParticleSystem>(); showControlGuides = gameHandler.GetComponent<ShowControlGuides>(); scoreHandler = gameHandler.GetComponent<HandleScore>(); int startPlayer; if (PlayerPrefs.GetString("gamemode") == "singleplayer") { startPlayer = 2; } else { startPlayer = (int)(Random.Range(1, 3) + 0.5F); // choose start player at random } GoToSpawn(startPlayer); // move ball next to start player's paddle }
void Start() { speed = StartSpeed; particles = transform.Find("BallParticle").GetComponent <ParticleSystem>(); showControlGuides = gameHandler.GetComponent <ShowControlGuides>(); scoreHandler = gameHandler.GetComponent <HandleScore>(); int startPlayer; if (PlayerPrefs.GetString("gamemode") == "singleplayer") { startPlayer = 2; } else { startPlayer = (int)(Random.Range(1, 3) + 0.5F); // choose start player at random } GoToSpawn(startPlayer); // move ball next to start player's paddle }