Graphics Reference
In-Depth Information
if( isAIControlled )
{
GetAIInput();
} else {
GetInput();
}
} else {
if( isAIControlled )
{
// since the battle is not running, we'll
// tell the AI gunControl not to fire yet
gunControl.canControl=false;
}
}
// see if our car is supposed to be held in place
CheckLock();
// update the audio
UpdateEngineAudio();
// finally, update the tread scrolling texture
if(treadMaterial!=null)
treadMaterial.SetTextureOffset ( "_MainTex", new
Vector2(0, treadMaterial.mainTextureOffset.y +
(mySpeed * -0.005f) ) );
}
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);
}
// fire if we need to
if( default_input.GetFire() && canFire )
{
// tell weapon controller to deal with firing
weaponControl.Fire();
if(canPlayFireSound)
{
canPlayFireSound=false;
Search WWH ::




Custom Search