Graphics Reference
In-Depth Information
accelMax= originalAccelMax;
// do catch up if this car is falling behind in the race
if(isRaceRunning && isAIControlled)
{
if(myRacePosition>3)
{
// speed up
accelMax= catchUpAccelMax;
} else {
accelMax= originalAccelMax;
}
// first place, let's slow you down!
if(myRacePosition<2)
{
accelMax= originalAccelMax*0.25f;
}
}
// update the audio
UpdateEngineAudio();
}
public override void GetInput()
{
// calculate steering amount
steer= Mathf.Clamp( default_input.GetHorizontal() , -1, 1 );
// how much accelerator?
motor= Mathf.Clamp( default_input.GetVertical() , 0, 1 );
// how much brake?
brake= -1 * Mathf.Clamp( default_input.GetVertical() , -1, 0 );
if( default_input.GetRespawn() && !isRespawning &&
canRespawn)
{
isRespawning=true;
Respawn();
canRespawn=false;
Invoke ("resetRespawn",2);
}
// first, we make sure that a weapon controller exists
// (otherwise no need to fire!)
if( weaponControl != null )
{
// fire if we need to
if( default_input.GetFire() && canFire )
{
// tell weapon controller to deal with firing
weaponControl.Fire();
}
}
}
Search WWH ::




Custom Search