Graphics Reference
In-Depth Information
// and tell it to chase our player around the screen (we get
// the player transform from game controller)
aControl.SetChaseTarget( GameController_LBS.Instance.GetMainPlayerTransform() );
// now get on and chase it!
aControl.SetAIState( AIStates.AIState.chasing_target );
// we also need to add this enemy to the radar, so we will
// tell game controller about it and some code in game
// controller will do this for us
GameController_LBS.Instance.AddEnemyToRadar( myTransform );
}
// game controller specifics (overridden for our laser blast
survival game controller)
// ----------------------------------------------------------------
public override void TellGCEnemyDestroyed()
{
// tell the game controller we have been destroyed
GameController_LBS.Instance.EnemyDestroyed( myTransform.
position, pointsValue, tempINT );
// remove this enemy from the radar
GameController_LBS.Instance.RemoveEnemyFromRadar(
myTransform );
}
public override void TellGCBossDestroyed()
{
// tell the game controller we have been destroyed (and that
// we are a boss!)
GameController_LBS.Instance.BossDestroyed();
// remove this enemy from the radar
GameController_LBS.Instance.RemoveEnemyFromRadar(
myTransform );
}
}
11.7.1 Script Breakdown
The EnemyBot_LBS class derives from BaseArmedEnemy, as described in Chapter 4 of
this topic:
public class EnemyBot_LBS : BaseArmedEnemy
{
public void Start ()
{
base.Start ();
// let's find our AI controller
BaseAIController aControl= (BaseAIController) gameObject.Get
Component<BaseAIController>();
// and tell it to chase our player around the screen (we get
// the player transform from game controller)
aControl.SetChaseTarget( GameController_LBS.Instance.GetMainPlayerTransform() );
// now get on and chase it!
Search WWH ::




Custom Search