Graphics Reference
In-Depth Information
The UpdateRacersRaceState() function is used to tell all of the drivers when there is
a change in the state of the race running. When it is called, each race control script, from
the Hashtable raceControllers, receives a function call to UpdateRaceState(), passing in a
parameter of raceRunning, the Boolean variable holding a state of whether or not the race
is still running:
void UpdateRacersRaceState()
{
for ( int b = 1; b <= numberOfRacers; b++ )
{
tempRC = (RaceController) raceControllers [b];
tempRC.UpdateRaceState(raceRunning);
}
}
}
12.3.4 Vehicle/Custom Player Control
The main player script, CarController_MVD.cs, hooks into the AI controller system from
Chapter 9, to provide both a user- and an AI-controlled vehicle system all in one. As if that
weren't enough, it also hooks into the weapon control system from Chapter 6. The script
in full looks like this:
using UnityEngine;
using System.Collections;
public class CarController_MVD : BaseVehicle
{
public Standard_SlotWeaponController weaponControl;
public bool canFire;
public bool isRespawning;
public bool isAIControlled;
public bool isInvulnerable;
public BaseAIController AIController;
public int startHealthAmount= 50;
public BasePlayerManager myPlayerManager;
public BaseUserManager myDataManager;
public float turnTorqueHelper= 90;
public float TurnTorqueHelperMaxSpeed= 30;
public float catchUpAccelMax= 8000;
public float originalAccelMax= 5000;
public float resetTime= 4;
public LayerMask respawnLayerMask;
private BaseArmedEnemy gunControl;
private RaceController raceControl;
private int racerID;
Search WWH ::




Custom Search