public void PlacePlayers(int controlers) { for (int i = 0; i < controlers; i++) { GameObject nP = Instantiate(player, currentLevel.startLocations[i].position, Quaternion.Euler(currentLevel.startLocations[i].rotation.x, currentLevel.startLocations[i].rotation.y + 90, currentLevel.startLocations[i].rotation.x)); KartPhysics r = nP.GetComponentInChildren <KartPhysics>(); Racer t = nP.GetComponentInChildren <Racer>(); CarPartsSpawn p = nP.GetComponentInChildren <CarPartsSpawn>(); PlayerManager.instance.AddPlayer(p); } if (controlers == 1) { OnePlayer(); } if (controlers == 2) { TwoPlayers(); } if (controlers == 3) { ThreePlayers(); } if (controlers == 4) { FourPlayers(); } }
// Use this for initialization void Start() { carController = car.GetComponent <KartPhysics> (); targetObject.transform.position = points [0].transform.position; }