Graphics Reference
In-Depth Information
void MakeVulnerable()
{
isInvulnerable=false;
}
public void PlayerFinished()
{
// disable this vehicle
isAIControlled= false;
canControl= false;
canFire= false;
AIController.canControl= false;
motor= 0;
steer= 0;
}
void Check_If_Car_Is_Flipped()
{
if((myTransform.localEulerAngles.z > 80 &&
myTransform.localEulerAngles.z < 280) || (myTransform.
localEulerAngles.x > 80 && myTransform.localEulerAngles.x
< 280)){
resetTimer += Time.deltaTime;
} else {
resetTimer = 0;
}
if(resetTimer > resetTime)
Respawn();
}
void PlayerFinishedRace( int whichPositionDidFinish )
{
if( !isAIControlled )
{
// tell game controller that the game is finished
GameController_MVD.Instance.RaceComplete
(whichPositionDidFinish );
// take over the car with AI control
isAIControlled=true;
InitAI();
}
}
}
12.3.4.1 Script Breakdown
Its script derives from the BaseVehicle class, a vehicle movement controller outlined in
Chapter 5. It builds on the functionality of the base vehicle to provide the extra code
needed for it to it into the game framework and work as a game player rather than just a
simple vehicle control script:
using UnityEngine;
using System.Collections;
Search WWH ::




Custom Search