Graphics Reference
In-Depth Information
// save our accelMax value for later use, in case we need to
// change it to do AI catch up
originalAccelMax= accelMax;
// add default keyboard input if we don't already have one
default_input= myGO.GetComponent<Keyboard_Input>();
if( default_input==null )
default_input= myGO.AddComponent<Keyboard_Input>();
// cache a reference to the player controller
myPlayerController= myGO.GetComponent<BasePlayerManager>();
// call base class init
myPlayerController.Init();
// with this simple vehicle code, we set the center of mass
// low to try to keep the car from toppling over
myBody.centerOfMass= new Vector3(0,-6.5f,0);
// see if we can find an engine sound source, if we need to
if( engineSoundSource==null )
{
engineSoundSource= myGO.GetComponent<AudioSource>();
}
AddBattleController();
// get a ref to the weapon controller
weaponControl= myGO.GetComponent<BaseWeaponController>();
// if a player manager is not set in the editor, let's try
// to find one
if(myPlayerManager==null)
myPlayerManager=
myGO.GetComponent<BasePlayerManager>();
// cache ref to data manager
myDataManager= myPlayerManager.DataManager;
// set default data
myDataManager.SetName("Player");
myDataManager.SetHealth(startHealthAmount);
if(isAIControlled)
{
// set our name to an AI player
myDataManager.SetName("AIPlayer");
// set up AI
InitAI();
}
isGameRunning= true;
// store respawn point
respawnPoint= myTransform.position;
respawnRotation= myTransform.eulerAngles;
Search WWH ::




Custom Search