Graphics Reference
In-Depth Information
// set player control
thePlayerScript.SetUserInput( true );
// as this is the user, we want to focus on this for UI etc.
focusPlayerScript = thePlayerScript;
// tell the camera script to target this new player
cameraScript.SetTarget( playerGO1.transform );
// do initial lap counter display
UpdateLapCounter( 1 );
// lock all the players on the spot until we're ready to go
SetPlayerLocks( true );
// start the game in 3 seconds from now
Invoke( "StartRace" , 4 );
// update positions throughout the race, but we don't need
// to do this every frame, so just do it every half a second
// instead
InvokeRepeating( "UpdatePositions", 0.5f, 0.5f );
// hide our count in numbers
HideCount();
// schedule count in messages
Invoke( "ShowCount3", 1 );
Invoke( "ShowCount2", 2 );
Invoke( "ShowCount1", 3 );
Invoke( "HideCount", 4 );
// hide final position text
finalPositionText.gameObject.SetActive( false );
doneFinalMessage = false;
// start by hiding our wrong way message
wrongWaySign.SetActive( false );
didInit=true;
}
void StartRace ()
{
// the SetPlayerLocks function tells all players to unlock
SetPlayerLocks( false );
// tell the global race manager that we are now racing
GlobalRaceManager.Instance.StartRace();
}
void SetPlayerLocks ( bool aState )
{
// tell all of the players to set their locks
for ( int i = 0; i < numberOfRacers; i++ )
{
thePlayerScript = ( CarController_MVD ) playerList [i];
thePlayerScript.SetLock( aState );
Search WWH ::




Custom Search