Graphics Reference
In-Depth Information
raceControl.ResetLapCounter();
// get a ref to the weapon controller
weaponControl=
myGO.GetComponent<Standard_SlotWeaponController>();
// 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();
}
}
void InitAI()
{
// cache a reference to the AI controller
AIController= myGO.GetComponent<BaseAIController>();
// check to see if we found an AI controller component, if
// not we add one here
if(AIController==null)
AIController= myGO.AddComponent<BaseAIController>();
// initialize the AI controller
AIController.Init();
// tell the AI controller to go into waypoint steering mode
AIController.SetAIState( AIStates.AIState.steer_to_waypoint );
// disable our default input method
default_input.enabled=false;
// add an AI weapon controller
gunControl= myGO.GetComponent<BaseArmedEnemy>();
// if we don't already have a gun controller, let's add one
// to stop things breaking but
// warn about it so that it may be fixed
if( gunControl==null )
{
gunControl= myGO.AddComponent<BaseArmedEnemy>();
Search WWH ::




Custom Search