Graphics Reference
In-Depth Information
// we want to keep the player object alive right through the
// game, so we use DontDestroyOnLoad to keep it alive
DontDestroyOnLoad (this.transform);
didInit=false;
// tell our base class to initialize
base.Init ();
// now do our own init
this.Init();
}
public override void Init ()
{
// hide the invulnerability shield(!)
if(!godMode)
{
MakeVulnerable();
} else {
MakeInvulnerable();
}
// get a ref to the weapon controller
weaponControl=
myGO.GetComponent<Standard_SlotWeaponController>();
// tell weapon control who we are (so all weapon control can
// tell projectiles who sent them)
weaponControl.SetOwner(ownerID);
// if a player manager is not set in the editor, let's try
// to find one
if(myPlayerManager==null)
myPlayerManager=
myGO.GetComponent<BasePlayer Manager>();
myDataManager= myPlayerManager.DataManager;
myDataManager.SetName("Player");
myDataManager.SetHealth(3);
// update UI lives
if(ownerID==1)
{
// if our owner ID is 1, we must be player 1
GameController_IP.Instance.UpdateLivesP1(myDataManager.GetHealth());
} else {
// we are player 2, so set that UI instead
GameController_IP.Instance.UpdateLivesP2(myDataManager.GetHealth());
}
if(isMouseControlled)
{
// if we are going to use mouse controls, add a
// mouse input controller
Search WWH ::




Custom Search