Graphics Reference
In-Depth Information
}
}
void UpdatePositions()
{
// here we need to talk to the race controller to get what
// we need to display on screen
focusPlayerRacePosition=
GlobalRaceManager.Instance.GetPosition(1);
theLap= GlobalRaceManager.Instance.GetLapsDone(1) +1;
// update the display
UpdateRacePositionText();
UpdateLapCounter(theLap);
}
void UpdateLapCounter ( int theLap )
{
// if we've finished all the laps we need to finish, let's cap the
// number so that we can have the AI cars continue going around the
// track without any negative implications
if ( theLap > totalLaps )
theLap = totalLaps;
// now we set the text of our GUIText object lap count display
lapText.text = "Lap " + theLap.ToString() + " of " +
totalLaps.ToString();
}
void UpdateRacePositionText ()
{
posText.text = "Pos " + focusPlayerRacePosition.ToString() + " of
"+ numberOfRacers.ToString();
}
private bool doneFinalMessage;
public void RaceComplete ( int finalPosition )
{
if ( !doneFinalMessage )
{
if ( finalPosition == 1 )
finalPositionText.text = "FINISHED 1st";
if ( finalPosition == 2 )
finalPositionText.text = "FINISHED 2nd";
if ( finalPosition == 3 )
finalPositionText.text = "FINISHED 3rd";
if ( finalPosition >= 4 )
finalPositionText.text = "FINISHED";
doneFinalMessage = true;
finalPositionText.gameObject.SetActive(true);
Search WWH ::




Custom Search