Graphics Reference
In-Depth Information
// if you are using primitives, only use a single collider
// on the same gameobject which has this script on
// when something collides with our ship, we check its layer
// to see if it is on 11 which is our projectiles
// (Note: remember when you add projectiles set the layer
// correctly!)
if(collider.gameObject.layer==11 && !isRespawning &&
!isInvulnerable)
{
LostLife();
}
}
MakeInvulnerable() and MakeVulnerable() simply set the Boolean isInvulnerable
variable to true or false, respectively:
void MakeInvulnerable()
{
isInvulnerable=true;
}
void MakeVulnerable()
{
isInvulnerable=false;
}
The final part of the script informs the game controller when this player is completely
finished with. This player will be inactive until its isFinished Boolean variable is reset to
false:
public void PlayerFinished()
{
// tell the player controller that we have finished
GameController_LBS.Instance.PlayerDied( id );
isFinished=true;
}
}
11. 7 Enemies
EnemyBot_LBS.cs is a surprisingly straightforward script, thanks to the BaseAIController.cs
and the BaseArmedEnemy.cs scripts it uses at its core:
public class EnemyBot_LBS : BaseArmedEnemy
{
public void Start ()
{
base.Start ();
// let's find our AI controller
BaseAIController aControl= (BaseAIController)
gameObject.GetComponent<BaseAIController>();
Search WWH ::




Custom Search