Graphics Reference
In-Depth Information
MakeVulnerable();
// grab volume from sound controller for our engine sound
audio.volume= BaseSoundController.Instance.volume;
}
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>();
Debug.LogWarning("WARNING! Trying to initialize car
without a BaseArmedEnemy component attached. Player
cannot fire!");
}
// tell gun controller to do 'look and destroy'
gunControl.currentState=
AIAttackStates.AIAttackState.look_and_destroy;
}
void AddBattleController()
{
if(myGO==null)
myGO=gameObject;
// add a battle controller script to our object
battleControl= myGO.AddComponent<BattleController>();
// grab an ID from the battle control script, so we don't
// have to look it up whenever we communicate with
// the global battle controller
racerID= battleControl.GetID();
Search WWH ::




Custom Search