Graphics Reference
In-Depth Information
SpawnController.Instance.SetUpPlayers( playerPrefabList,
playerStarts, playerRotations, playerParent, numberOfRacers );
playerTransforms=new ArrayList();
// now let's grab references to each player's controller
//script
playerTransforms = SpawnController.Instance.
GetAllSpawnedPlayers();
playerList=new ArrayList();
for ( int i = 0; i < numberOfRacers; i++ )
{
Transform tempT= (Transform)playerTransforms[i];
CarController_MVD tempController= tempT.
GetComponent<CarController_MVD>();
playerList.Add(tempController);
BaseAIController
tempAI=tempController.GetComponent<BaseAIControl
ler>();
// tell each player where to find the waypoints
tempAI.SetWayController(WaypointControllerForAI);
tempController.Init ();
// tell the car controller script about the waypoint
// controller so it can pass it on to the
// racecontroller (!)
tempController.SetWayController(WaypointControllerForAI);
}
// grab a ref to the player's gameobject for later use
playerGO1 = SpawnController.Instance.GetPlayerGO( 0 );
// add an audio listener to the first car so that the audio
// is based from the car rather than from the main camera
playerGO1.AddComponent<AudioListener>();
// look at the main camera and see if it has an audio
// listener attached
AudioListener tempListener=
Camera.main.GetComponent<AudioListener>();
// if we found a listener, let's destroy it
if( tempListener!=null )
Destroy(tempListener);
// grab a reference to the focussed player's car controller script,
// so that we can do things like access its speed variable
thePlayerScript = ( CarController_MVD )
playerGO1.GetComponent<CarController_MVD>();
// assign this player the id of 0
thePlayerScript.SetID( 0 );
Search WWH ::




Custom Search